aboutsummaryrefslogtreecommitdiff
path: root/uritemplate/template.py
diff options
context:
space:
mode:
authorLee Skillen <lskillen@cloudsmith.io>2018-01-31 16:21:43 +0000
committerLee Skillen <lskillen@cloudsmith.io>2018-09-10 00:40:45 +0100
commit12c9fdf6cc413d2b227302181d20456361d94e3b (patch)
tree4ef27fa132be344b3d90260309f443eb09b0520d /uritemplate/template.py
parent86f495286ba47fe825878c32d7fa3ea4a1c10c87 (diff)
downloaduritemplates-12c9fdf6cc413d2b227302181d20456361d94e3b.tar.gz
Make variable ordering deterministic
Diffstat (limited to 'uritemplate/template.py')
-rw-r--r--uritemplate/template.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/uritemplate/template.py b/uritemplate/template.py
index ceca8eb..0df0da6 100644
--- a/uritemplate/template.py
+++ b/uritemplate/template.py
@@ -16,6 +16,7 @@ What do you do?
"""
import re
+from uritemplate.orderedset import OrderedSet
from uritemplate.variable import URIVariable
template_re = re.compile('{([^}]+)}')
@@ -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