web/views/apacherewrite.py
branchtls-sprint
changeset 1802 d628defebc17
parent 661 4f61eb8a96b7
child 1936 c5af2fbda5b6
--- a/web/views/apacherewrite.py	Thu May 14 10:24:56 2009 +0200
+++ b/web/views/apacherewrite.py	Thu May 14 11:38:40 2009 +0200
@@ -28,7 +28,7 @@
     def match(self, **kwargs):
         self._match = self.condition.match(kwargs[self.match_part])
         return not self._match is None
-    
+
     def action_rewrite(self, path):
         for rgx, replace in self.rules:
             if not rgx.match(path) is None:
@@ -45,7 +45,7 @@
     def action_stop(self, path):
         return path
 
-    
+
 class ApacheURLRewrite(Component):
     """inherit from this class with actual rules to activate apache style rewriting
 
@@ -69,24 +69,24 @@
         RewriteRule ^/(data/.*) http://localhost:8080/$1 [L,P]
         RewriteRule ^/(json.*) http://localhost:8080/$1 [L,P]
         RewriteRule ^/(.*) http://localhost:8080/m_%1/$1 [L,P]
-    
+
     could be written (considering that no "host rewritting" is necessary):
 
-      class MyAppRules(ApacheURLRewrite): 
+      class MyAppRules(ApacheURLRewrite):
         rules = [
           RewriteCond('logilab\.fr', match='host',
                       rules=[('/(.*)', r'http://www.logilab.fr/\1')],
                       action='redirect'),
           RewriteCond('(www)\.logilab\.fr', match='host', action='stop'),
           RewriteCond('/(data|json)/', match='path', action='stop'),
-          RewriteCond('(?P<cat>.*)\.logilab\.fr', match='host', 
+          RewriteCond('(?P<cat>.*)\.logilab\.fr', match='host',
                       rules=[('/(.*)', r'/m_%(cat)s/\1')]),
         ]
     """
     __abstract__ = True
     id = 'urlrewriter'
     rules = []
-        
+
     def rewrite(self, host, path):
         for cond in self.rules:
             if cond.match(host=host, path=path):