summaryrefslogtreecommitdiff
path: root/routes
diff options
context:
space:
mode:
authorBen Bangert <ben@groovie.org>2010-06-05 09:59:48 -0700
committerBen Bangert <ben@groovie.org>2010-06-05 09:59:48 -0700
commite16850351443b4294383aa91cd22a32aab7f081a (patch)
tree76d5776d1f2af164c511efc951f8e148911d31ac /routes
parent086414263069a5d268835a9f2becf7fe6d78ef62 (diff)
downloadroutes-e16850351443b4294383aa91cd22a32aab7f081a.tar.gz
* Fix bug with URLGenerator not properly including SCRIPT_NAME when generating
URL's and the singleton is not present. --HG-- branch : trunk
Diffstat (limited to 'routes')
-rw-r--r--routes/mapper.py7
-rw-r--r--routes/util.py1
2 files changed, 5 insertions, 3 deletions
diff --git a/routes/mapper.py b/routes/mapper.py
index 50f7482..18ade09 100644
--- a/routes/mapper.py
+++ b/routes/mapper.py
@@ -717,6 +717,7 @@ class Mapper(SubMapperParent):
if 'action' not in kargs:
kargs['action'] = 'index'
+ environ = kargs.pop('_environ', self.environ)
controller = kargs.get('controller', None)
action = kargs.get('action', None)
@@ -729,7 +730,7 @@ class Mapper(SubMapperParent):
if self.urlcache is not None:
if self.environ:
cache_key_script_name = '%s:%s' % (
- self.environ.get('SCRIPT_NAME', ''), cache_key)
+ environ.get('SCRIPT_NAME', ''), cache_key)
else:
cache_key_script_name = cache_key
@@ -824,9 +825,9 @@ class Mapper(SubMapperParent):
if self.prefix:
path = self.prefix + path
external_static = route.static and route.external
- if self.environ and self.environ.get('SCRIPT_NAME', '') != ''\
+ if environ and environ.get('SCRIPT_NAME', '') != ''\
and not route.absolute and not external_static:
- path = self.environ['SCRIPT_NAME'] + path
+ path = environ['SCRIPT_NAME'] + path
key = cache_key_script_name
else:
key = cache_key
diff --git a/routes/util.py b/routes/util.py
index 6c3f845..d0d9672 100644
--- a/routes/util.py
+++ b/routes/util.py
@@ -389,6 +389,7 @@ class URLGenerator(object):
anchor = anchor or newargs.pop('_anchor', None)
host = host or newargs.pop('_host', None)
protocol = protocol or newargs.pop('_protocol', None)
+ newargs['_environ'] = self.environ
url = self.mapper.generate(*route_args, **newargs)
if anchor is not None:
url += '#' + _url_quote(anchor, encoding)