mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Update routes
This commit is contained in:
parent
fe97e602f4
commit
e03f31d7c0
@ -717,6 +717,7 @@ class Mapper(SubMapperParent):
|
|||||||
if 'action' not in kargs:
|
if 'action' not in kargs:
|
||||||
kargs['action'] = 'index'
|
kargs['action'] = 'index'
|
||||||
|
|
||||||
|
environ = kargs.pop('_environ', self.environ)
|
||||||
controller = kargs.get('controller', None)
|
controller = kargs.get('controller', None)
|
||||||
action = kargs.get('action', None)
|
action = kargs.get('action', None)
|
||||||
|
|
||||||
@ -729,7 +730,7 @@ class Mapper(SubMapperParent):
|
|||||||
if self.urlcache is not None:
|
if self.urlcache is not None:
|
||||||
if self.environ:
|
if self.environ:
|
||||||
cache_key_script_name = '%s:%s' % (
|
cache_key_script_name = '%s:%s' % (
|
||||||
self.environ.get('SCRIPT_NAME', ''), cache_key)
|
environ.get('SCRIPT_NAME', ''), cache_key)
|
||||||
else:
|
else:
|
||||||
cache_key_script_name = cache_key
|
cache_key_script_name = cache_key
|
||||||
|
|
||||||
@ -824,9 +825,9 @@ class Mapper(SubMapperParent):
|
|||||||
if self.prefix:
|
if self.prefix:
|
||||||
path = self.prefix + path
|
path = self.prefix + path
|
||||||
external_static = route.static and route.external
|
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:
|
and not route.absolute and not external_static:
|
||||||
path = self.environ['SCRIPT_NAME'] + path
|
path = environ['SCRIPT_NAME'] + path
|
||||||
key = cache_key_script_name
|
key = cache_key_script_name
|
||||||
else:
|
else:
|
||||||
key = cache_key
|
key = cache_key
|
||||||
|
@ -389,6 +389,7 @@ class URLGenerator(object):
|
|||||||
anchor = anchor or newargs.pop('_anchor', None)
|
anchor = anchor or newargs.pop('_anchor', None)
|
||||||
host = host or newargs.pop('_host', None)
|
host = host or newargs.pop('_host', None)
|
||||||
protocol = protocol or newargs.pop('_protocol', None)
|
protocol = protocol or newargs.pop('_protocol', None)
|
||||||
|
newargs['_environ'] = self.environ
|
||||||
url = self.mapper.generate(*route_args, **newargs)
|
url = self.mapper.generate(*route_args, **newargs)
|
||||||
if anchor is not None:
|
if anchor is not None:
|
||||||
url += '#' + _url_quote(anchor, encoding)
|
url += '#' + _url_quote(anchor, encoding)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user