diff options
Diffstat (limited to 'uritemplate/template.py')
-rw-r--r-- | uritemplate/template.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/uritemplate/template.py b/uritemplate/template.py index c9d7c7e..0df0da6 100644 --- a/uritemplate/template.py +++ b/uritemplate/template.py @@ -16,9 +16,10 @@ What do you do? """ import re +from uritemplate.orderedset import OrderedSet from uritemplate.variable import URIVariable -template_re = re.compile('{([^\}]+)}') +template_re = re.compile('{([^}]+)}') def _merge(var_dict, overrides): @@ -71,9 +72,10 @@ class URITemplate(object): URIVariable(m.groups()[0]) for m in template_re.finditer(self.uri) ] #: A set of variable names in the URI. - self.variable_names = set() + self.variable_names = OrderedSet() for variable in self.variables: - self.variable_names.update(variable.variable_names) + for name in variable.variable_names: + self.variable_names.add(name) def __repr__(self): return 'URITemplate("%s")' % self |