Update routes

This commit is contained in:
Kovid Goyal 2011-09-23 13:13:46 -06:00
parent fe97e602f4
commit e03f31d7c0
2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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)