diff options
-rw-r--r-- | CHANGELOG | 8 | ||||
-rw-r--r-- | routes/base.py | 8 |
2 files changed, 15 insertions, 1 deletions
@@ -1,7 +1,13 @@ Routes Changelog ======================== --- 1.3.3 (**dev**) +-- 1.3.3 (**SVN**) +* Added URL generation handling for a 'method' argument. If 'method' is specified, it + is not dropped and will be changed to '_method' for use by the framework. +* Added conditions option to map.connect. Accepts a dict with optional keyword args + 'method' or 'function'. Method is a list of HTTP methods that are valid for the route. + Function is a function that will be called with environ, matchdict where matchdict is + the dict created by the URL match. * Fixed redirect_to function for using absolute URL's. redirect_to now passes all args to url_for, then passes the resulting URL to the redirect function. Reported by climbus. diff --git a/routes/base.py b/routes/base.py index c759b3e..b5a3848 100644 --- a/routes/base.py +++ b/routes/base.py @@ -368,6 +368,14 @@ class Route(object): if val and not self.req_regs[key].match(str(val)): return False + # Verify that if we have a method arg, its in the method accept list. Also, method + # will be changed to _method for route generation + meth = kargs.pop('method', None) + if meth: + kargs['_method'] = meth + if meth not in self.conditions.get('method', [meth]): + return False + routelist = self.routebackwards urllist = [] gaps = False |