10 from cubicweb.web.views.apacherewrite import * |
10 from cubicweb.web.views.apacherewrite import * |
11 |
11 |
12 class ApacheURLRewriteTC(TestCase): |
12 class ApacheURLRewriteTC(TestCase): |
13 |
13 |
14 def test(self): |
14 def test(self): |
15 class MyAppRules(ApacheURLRewrite): |
15 class MyAppRules(ApacheURLRewrite): |
16 rules = [ |
16 rules = [ |
17 RewriteCond('logilab\.fr', match='host', |
17 RewriteCond('logilab\.fr', match='host', |
18 rules=[('/(.*)', r'http://www.logilab.fr/\1')], |
18 rules=[('/(.*)', r'http://www.logilab.fr/\1')], |
19 action='redirect'), |
19 action='redirect'), |
20 RewriteCond('(www)\.logilab\.fr', match='host', action='stop'), |
20 RewriteCond('(www)\.logilab\.fr', match='host', action='stop'), |
21 RewriteCond('/(data|json)/', match='path', action='stop'), |
21 RewriteCond('/(data|json)/', match='path', action='stop'), |
22 RewriteCond('(?P<cat>.*)\.logilab\.fr', match='host', |
22 RewriteCond('(?P<cat>.*)\.logilab\.fr', match='host', |
23 rules=[('/(.*)', r'/m_%(cat)s/\1')]), |
23 rules=[('/(.*)', r'/m_%(cat)s/\1')]), |
24 ] |
24 ] |
25 urlrewriter = MyAppRules() |
25 urlrewriter = MyAppRules() |
26 req = None # not used in the above rules, so keep a simple TestCase here |
26 req = None # not used in the above rules, so keep a simple TestCase here |
27 try: |
27 try: |