pass request to ApacheRewriter rewrite method
authorFlorent <florent@secondweb.fr>
Mon, 25 May 2009 22:26:05 +0200
changeset 1936 c5af2fbda5b6
parent 1935 a54a3b665361
child 1938 bf27b4190739
pass request to ApacheRewriter rewrite method
etwist/server.py
web/views/apacherewrite.py
--- a/etwist/server.py	Mon May 25 22:21:13 2009 +0200
+++ b/etwist/server.py	Mon May 25 22:26:05 2009 +0200
@@ -196,7 +196,7 @@
         if self.url_rewriter is not None:
             # XXX should occur before authentication?
             try:
-                path = self.url_rewriter.rewrite(host, origpath)
+                path = self.url_rewriter.rewrite(host, origpath, req)
             except Redirect, ex:
                 return self.redirect(req, ex.location)
             request.uri.replace(origpath, path, 1)
--- a/web/views/apacherewrite.py	Mon May 25 22:21:13 2009 +0200
+++ b/web/views/apacherewrite.py	Mon May 25 22:26:05 2009 +0200
@@ -87,7 +87,8 @@
     id = 'urlrewriter'
     rules = []
 
-    def rewrite(self, host, path):
+    def rewrite(self, host, path, req):
+        self.req = req
         for cond in self.rules:
             if cond.match(host=host, path=path):
                 return cond.process(path)