summaryrefslogtreecommitdiff
path: root/routes/route.py
diff options
context:
space:
mode:
Diffstat (limited to 'routes/route.py')
-rw-r--r--routes/route.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/routes/route.py b/routes/route.py
index cf6df10..719636a 100644
--- a/routes/route.py
+++ b/routes/route.py
@@ -364,7 +364,6 @@ class Route(object):
self.prior = part
(rest, noreqs, allblank) = self.buildnextreg(path[1:], clist,
include_names)
-
if isinstance(part, dict) and part['type'] in (':', '.'):
var = part['name']
typ = part['type']
@@ -502,7 +501,13 @@ class Route(object):
reg += ')?'
else:
allblank = False
- reg = re.escape(part) + rest
+ # Starting in Python 3.7, the / is no longer escaped, however quite a bit of
+ # route generation code relies on it being escaped. This forces the escape in
+ # Python 3.7+ so that the remainder of the code functions as intended.
+ if part == '/':
+ reg = r'\/' + rest
+ else:
+ reg = re.escape(part) + rest
# We have a normal string here, this is a req, and it prevents us from
# being all blank