diff options
author | Ben Bangert <ben@groovie.org> | 2010-02-28 14:37:05 -0800 |
---|---|---|
committer | Ben Bangert <ben@groovie.org> | 2010-02-28 14:37:05 -0800 |
commit | 544fb83fe3cc4df3e5295b71b205c611c4c1dd5a (patch) | |
tree | f632da5852876527ffb419b1714250ef93713f41 /routes | |
parent | 75c770d5c7f7bf1ff93b006dd663dd78cd87a14b (diff) | |
download | routes-544fb83fe3cc4df3e5295b71b205c611c4c1dd5a.tar.gz |
* Fix url.current() not returning current args when explicit is True.
* Return explicit to being default to True.
--HG--
branch : trunk
Diffstat (limited to 'routes')
-rw-r--r-- | routes/mapper.py | 2 | ||||
-rw-r--r-- | routes/util.py | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/routes/mapper.py b/routes/mapper.py index d37a011..65ed7a0 100644 --- a/routes/mapper.py +++ b/routes/mapper.py @@ -293,7 +293,7 @@ class Mapper(SubMapperParent): """ def __init__(self, controller_scan=controller_scan, directory=None, - always_scan=False, register=True, explicit=False): + always_scan=False, register=True, explicit=True): """Create a new Mapper instance All keyword arguments are optional. diff --git a/routes/util.py b/routes/util.py index f56e9ab..71bdf1d 100644 --- a/routes/util.py +++ b/routes/util.py @@ -23,7 +23,7 @@ class GenerationException(RoutesException): """Tossed during URL generation exceptions""" -def _screenargs(kargs, mapper, environ): +def _screenargs(kargs, mapper, environ, force_explicit=False): """ Private function that takes a dict, and screens it against the current request dict to determine what the dict should look like that is used. @@ -35,9 +35,9 @@ def _screenargs(kargs, mapper, environ): if isinstance(val, unicode): kargs[key] = val.encode(encoding) - if mapper.explicit and mapper.sub_domains: + if mapper.explicit and mapper.sub_domains and not force_explicit: return _subdomain_check(kargs, mapper, environ) - elif mapper.explicit: + elif mapper.explicit and not force_explicit: return kargs controller_name = kargs.get('controller') @@ -53,6 +53,8 @@ def _screenargs(kargs, mapper, environ): route_args = environ.get('wsgiorg.routing_args') if route_args: memory_kargs = route_args[1].copy() + else: + memory_kargs = {} # Remove keys from memory and kargs if kargs has them as None for key in [key for key in kargs.keys() if kargs[key] is None]: @@ -372,7 +374,7 @@ class URLGenerator(object): newargs = _subdomain_check(newargs, self.mapper, self.environ) elif use_current: - newargs = _screenargs(kargs, self.mapper, self.environ) + newargs = _screenargs(kargs, self.mapper, self.environ, force_explicit=True) elif 'sub_domain' in kargs: newargs = _subdomain_check(kargs, self.mapper, self.environ) else: |