Permalink
Browse files

fix bug with RouteGuarded.response attr

  • Loading branch information...
1 parent 3374bc8 commit 02a8c9ba97c06668957c8be829cf795d7e16c63f @andreypopp committed Apr 13, 2012
Showing with 10 additions and 6 deletions.
  1. +5 −2 CHANGES
  2. +3 −3 routr/__init__.py
  3. +2 −1 routr/exc.py
View
@@ -1,9 +1,12 @@
-0.1.5 (unreleased)
-------------------
+0.1.5
+-----
* introduced RequestParams.exception_factory which abstracts away
HTTPBadRequest raise in case of invalid data being supplied
+ * [bugfix] RouteGuarded.response now installed correctly, previously it
+ sometimes contained NoUrlMatched objects which are not responses
+
0.1.4
-----
View
@@ -285,10 +285,10 @@ def match(self, path_info, request):
except NoURLPatternMatched:
continue
except MethodNotAllowed, e:
- guarded.append(e)
+ guarded.append(RouteGuarded(e, e.response))
continue
except HTTPException, e:
- guarded.append(e)
+ guarded.append(RouteGuarded(e, e))
continue
else:
return ((trace + subtrace)
@@ -297,7 +297,7 @@ def match(self, path_info, request):
if guarded:
# NOTE we raise only last guard failure
# cause it's more interesting one
- raise RouteGuarded(guarded[-1])
+ raise guarded[-1]
raise NoURLPatternMatched()
def __iter__(self):
View
@@ -35,7 +35,8 @@ class RouteGuarded(NoMatchFound):
:class:``webob.exc.HTTPException``
"""
- def __init__(self, response):
+ def __init__(self, reason, response):
+ self.reason = reason
self.response = response
class MethodNotAllowed(NoMatchFound):

0 comments on commit 02a8c9b

Please sign in to comment.