aboutsummaryrefslogtreecommitdiff
path: root/uritemplate
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2013-05-01 10:52:50 -0400
committerIan Cordasco <graffatcolmingov@gmail.com>2013-05-01 10:52:50 -0400
commitd59523164eda1309cb6aef9d62e351c3ef96fe77 (patch)
tree888b3ec9a19b2a297534690a5207456b4c79c343 /uritemplate
parent3bb2b07e2b98f2cb6695df26bc207b38989c0d1f (diff)
downloaduritemplates-d59523164eda1309cb6aef9d62e351c3ef96fe77.tar.gz
Rename var_list and when empty return uri
var_list has a better API name of variables now, and upon expansion, if it is empty just return the plain URI. Also, let's start testing this stuff.
Diffstat (limited to 'uritemplate')
-rw-r--r--uritemplate/template.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/uritemplate/template.py b/uritemplate/template.py
index 6f28e2d..7479be1 100644
--- a/uritemplate/template.py
+++ b/uritemplate/template.py
@@ -43,7 +43,7 @@ class URITemplate(object):
"""
def __init__(self, uri):
self.uri = uri
- self.var_list = [
+ self.variables = [
URIVariable(m.groups()[0]) for m in template_re.finditer(self.uri)
]
@@ -51,7 +51,9 @@ class URITemplate(object):
return 'URITemplate({0})'.format(self.uri)
def expand(self, *args, **kwargs):
- pass
+ if not self.variables:
+ return self.uri
+ return ''
class URIVariable(object):