changeset 14:d54f85043f77

better and more configurable matching logic
author k0s <k0scist@gmail.com>
date Wed, 18 Nov 2009 15:39:11 -0500
parents 6075ca965357
children 3b4cae1f6d75
files genshi_view/template/+package+/handlers.py
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/genshi_view/template/+package+/handlers.py	Sat Nov 07 22:55:06 2009 -0500
+++ b/genshi_view/template/+package+/handlers.py	Wed Nov 18 15:39:11 2009 -0500
@@ -16,21 +16,21 @@
 
     @classmethod
     def match(cls, app, request):
+
+        # check the method
+        if request.method not in cls.methods:
+            return None
+
+        # check the path
+        if request.environ['path'][:len(cls.handler_path)] != cls.handler_path:
+            return None
+
         try:
             return cls(app, request)
         except HandlerMatchException:
             return None
     
     def __init__(self, app, request):
-
-        # check the method
-        if request.method not in self.methods:
-            raise HandlerMatchException
-
-        # check the path
-        if request.environ['path'][:len(self.handler_path)] != self.handler_path:
-            raise HandlerMatchException
-
         self.app = app
         self.request = request
         self.application_path = urlparse(request.application_url)[2]