summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Bangert <ben@groovie.org>2015-01-17 11:20:15 -0800
committerBen Bangert <ben@groovie.org>2015-01-17 11:20:15 -0800
commitda4f235ce6e48046bf95bef03cffe23fcdf907a1 (patch)
tree49cabf76da6b4f441aeac4edb8ac14c93630913d
parent0f89bb7b38915148a9eae1792709972010a05078 (diff)
downloadroutes-da4f235ce6e48046bf95bef03cffe23fcdf907a1.tar.gz
Whitespace removal.
-rw-r--r--tests/test_functional/test_explicit_use.py38
-rw-r--r--tests/test_functional/test_middleware.py36
-rw-r--r--tests/test_functional/test_nonminimization.py38
-rw-r--r--tests/test_functional/test_recognition.py272
-rw-r--r--tests/test_functional/test_resources.py98
-rw-r--r--tests/test_functional/test_submapper.py28
-rw-r--r--tests/test_functional/test_utils.py226
7 files changed, 368 insertions, 368 deletions
diff --git a/tests/test_functional/test_explicit_use.py b/tests/test_functional/test_explicit_use.py
index 3f667c4..d6e1879 100644
--- a/tests/test_functional/test_explicit_use.py
+++ b/tests/test_functional/test_explicit_use.py
@@ -11,19 +11,19 @@ class TestUtils(unittest.TestCase):
m = Mapper()
m.explicit = True
m.connect('/hi/{fred}')
-
+
environ = {'HTTP_HOST': 'localhost'}
-
+
env = environ.copy()
env['PATH_INFO'] = '/hi/george'
-
+
eq_({'fred': 'george'}, m.match(environ=env))
def test_x_forwarded(self):
m = Mapper()
m.explicit = True
m.connect('/hi/{fred}')
-
+
environ = {'HTTP_X_FORWARDED_HOST': 'localhost'}
url = URLGenerator(m, environ)
eq_('http://localhost/hi/smith', url(fred='smith', qualified=True))
@@ -32,7 +32,7 @@ class TestUtils(unittest.TestCase):
m = Mapper()
m.explicit = True
m.connect('/hi/{fred}')
-
+
environ = {'SERVER_NAME': 'localhost', 'wsgi.url_scheme': 'https',
'SERVER_PORT': '993'}
url = URLGenerator(m, environ)
@@ -43,15 +43,15 @@ class TestUtils(unittest.TestCase):
m.explicit = True
m.sub_domains = True
m.connect('/hi/{fred}')
-
+
environ = {'HTTP_HOST': 'localhost.com'}
url = URLGenerator(m, environ)
eq_('http://home.localhost.com/hi/smith', url(fred='smith', sub_domain=u'home', qualified=True))
-
+
environ = {'HTTP_HOST': 'here.localhost.com', 'PATH_INFO': '/hi/smith'}
url = URLGenerator(m, environ.copy())
assert_raises(GenerationException, lambda: url.current(qualified=True))
-
+
url = URLGenerator(m, {})
eq_('/hi/smith', url(fred='smith', sub_domain=u'home'))
@@ -59,7 +59,7 @@ class TestUtils(unittest.TestCase):
m = Mapper()
m.explicit = True
m.connect('/hi/{fred}')
-
+
environ = {'HTTP_HOST': 'localhost.com'}
url = URLGenerator(m, environ)
eq_('/hi/smith#here', url(fred='smith', anchor='here'))
@@ -68,16 +68,16 @@ class TestUtils(unittest.TestCase):
m = Mapper()
m.explicit = True
m.connect('http://google.com/', _static=True)
-
+
url = URLGenerator(m, {})
-
+
eq_('/here?q=fred&q=here%20now', url('/here', q=[u'fred', 'here now']))
-
+
def test_current(self):
m = Mapper()
m.explicit = True
m.connect('/hi/{fred}')
-
+
environ = {'HTTP_HOST': 'localhost.com', 'PATH_INFO': '/hi/smith'}
match = m.routematch(environ=environ)[0]
environ['wsgiorg.routing_args'] = (None, match)
@@ -92,30 +92,30 @@ class TestUtils(unittest.TestCase):
]
map.extend(routes)
eq_(map.match('/foo'), {})
-
+
def test_using_func(self):
def fred(view): pass
-
+
m = Mapper()
m.explicit = True
m.connect('/hi/{fred}', controller=fred)
-
+
environ = {'HTTP_HOST': 'localhost.com', 'PATH_INFO': '/hi/smith'}
match = m.routematch(environ=environ)[0]
environ['wsgiorg.routing_args'] = (None, match)
url = URLGenerator(m, environ)
eq_('/hi/smith', url.current())
-
+
def test_using_prefix(self):
m = Mapper()
m.explicit = True
m.connect('/{first}/{last}')
-
+
environ = {'HTTP_HOST': 'localhost.com', 'PATH_INFO': '/content/index', 'SCRIPT_NAME': '/jones'}
match = m.routematch(environ=environ)[0]
environ['wsgiorg.routing_args'] = (None, match)
url = URLGenerator(m, environ)
-
+
eq_('/jones/content/index', url.current())
eq_('/jones/smith/barney', url(first='smith', last='barney'))
diff --git a/tests/test_functional/test_middleware.py b/tests/test_functional/test_middleware.py
index c0bdefd..000d383 100644
--- a/tests/test_functional/test_middleware.py
+++ b/tests/test_functional/test_middleware.py
@@ -18,7 +18,7 @@ def test_basic():
app = TestApp(RoutesMiddleware(simple_app, map))
res = app.get('/')
assert b'matchdict items are []' in res
-
+
res = app.get('/content')
assert b"matchdict items are [('action', 'index'), ('controller', " + repr(
u'content').encode() + b"), ('id', None)]" in res
@@ -29,7 +29,7 @@ def test_no_query():
map.connect('myapp/*path_info', controller='myapp')
map.connect('project/*path_info', controller='myapp')
map.create_regs(['content', 'myapp'])
-
+
app = RoutesMiddleware(simple_app, map)
env = {'PATH_INFO': '/', 'REQUEST_METHOD': 'GET', 'HTTP_HOST': 'localhost'}
def start_response_wrapper(status, headers, exc=None):
@@ -43,7 +43,7 @@ def test_content_split():
map.connect('myapp/*path_info', controller='myapp')
map.connect('project/*path_info', controller='myapp')
map.create_regs(['content', 'myapp'])
-
+
app = RoutesMiddleware(simple_app, map)
env = {'PATH_INFO': '/', 'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'text/plain;text/html',
'HTTP_HOST': 'localhost'}
@@ -58,14 +58,14 @@ def test_no_singleton():
map.connect('myapp/*path_info', controller='myapp')
map.connect('project/*path_info', controller='myapp')
map.create_regs(['content', 'myapp'])
-
+
app = RoutesMiddleware(simple_app, map, singleton=False)
env = {'PATH_INFO': '/', 'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'text/plain;text/html'}
def start_response_wrapper(status, headers, exc=None):
pass
response = b''.join(app(env, start_response_wrapper))
assert b'matchdict items are []' in response
-
+
# Now a match
env = {'PATH_INFO': '/project/fred', 'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': 'text/plain;text/html'}
def start_response_wrapper(status, headers, exc=None):
@@ -73,7 +73,7 @@ def test_no_singleton():
response = b''.join(app(env, start_response_wrapper))
assert b"matchdict items are [('action', " + repr(u'index').encode() + \
b"), ('controller', " + repr(u'myapp').encode() + b"), ('path_info', 'fred')]" in response
-
+
def test_path_info():
map = Mapper(explicit=False)
@@ -81,22 +81,22 @@ def test_path_info():
map.connect('myapp/*path_info', controller='myapp')
map.connect('project/*path_info', controller='myapp')
map.create_regs(['content', 'myapp'])
-
+
app = TestApp(RoutesMiddleware(simple_app, map))
res = app.get('/')
assert 'matchdict items are []' in res
-
+
res = app.get('/myapp/some/other/url')
print res
assert b"matchdict items are [('action', " + repr(u'index').encode() + \
b"), ('controller', " + repr(u'myapp').encode() + b"), ('path_info', 'some/other/url')]" in res
assert "'SCRIPT_NAME': '/myapp'" in res
assert "'PATH_INFO': '/some/other/url'" in res
-
+
res = app.get('/project/pylonshq/browser/pylons/templates/default_project/+package+/pylonshq/browser/pylons/templates/default_project/+package+/controllers')
print res
assert "'SCRIPT_NAME': '/project'" in res
- assert "'PATH_INFO': '/pylonshq/browser/pylons/templates/default_project/+package+/pylonshq/browser/pylons/templates/default_project/+package+/controllers'" in res
+ assert "'PATH_INFO': '/pylonshq/browser/pylons/templates/default_project/+package+/pylonshq/browser/pylons/templates/default_project/+package+/controllers'" in res
def test_redirect_middleware():
map = Mapper(explicit=False)
@@ -105,15 +105,15 @@ def test_redirect_middleware():
map.redirect("faq/{section}", "/static/faq/{section}.html")
map.redirect("home/index", "/", _redirect_code='301 Moved Permanently')
map.create_regs(['content', 'myapp'])
-
+
app = TestApp(RoutesMiddleware(simple_app, map))
res = app.get('/')
assert 'matchdict items are []' in res
-
+
res = app.get('/faq/home')
eq_('302 Found', res.status)
eq_(res.headers['Location'], '/static/faq/home.html')
-
+
res = app.get('/myapp/some/other/url')
print res
assert b"matchdict items are [('action', " + repr(u'index').encode() + \
@@ -121,7 +121,7 @@ def test_redirect_middleware():
b"), ('path_info', 'some/other/url')]" in res
assert "'SCRIPT_NAME': '/myapp'" in res
assert "'PATH_INFO': '/some/other/url'" in res
-
+
res = app.get('/home/index')
assert '301 Moved Permanently' in res.status
eq_(res.headers['Location'], '/')
@@ -135,17 +135,17 @@ def test_method_conversion():
app = TestApp(RoutesMiddleware(simple_app, map))
res = app.get('/')
assert 'matchdict items are []' in res
-
+
res = app.get('/content')
assert b"matchdict items are [('action', 'index'), ('controller', " + \
repr(u'content').encode() + b"), ('id', None)]" in res
-
+
res = app.get('/content/hopper', params={'_method':'DELETE'})
assert b"matchdict items are [('action', " + repr(u'index').encode() + \
b"), ('controller', " + repr(u'content').encode() + \
b"), ('type', " + repr(u'hopper').encode() + b")]" in res
-
- res = app.post('/content/grind',
+
+ res = app.post('/content/grind',
params={'_method':'DELETE', 'name':'smoth'},
headers={'Content-Type': 'application/x-www-form-urlencoded'})
assert b"matchdict items are [('action', " + repr(u'index').encode() + \
diff --git a/tests/test_functional/test_nonminimization.py b/tests/test_functional/test_nonminimization.py
index aca8dcf..e076f00 100644
--- a/tests/test_functional/test_nonminimization.py
+++ b/tests/test_functional/test_nonminimization.py
@@ -12,16 +12,16 @@ def test_basic():
m.minimization = False
m.connect('/:controller/:action/:id')
m.create_regs(['content'])
-
+
# Recognize
eq_(None, m.match('/content'))
eq_(None, m.match('/content/index'))
eq_(None, m.match('/content/index/'))
- eq_({'controller':'content','action':'index','id':'4'},
+ eq_({'controller':'content','action':'index','id':'4'},
m.match('/content/index/4'))
eq_({'controller':'content','action':'view','id':'4.html'},
m.match('/content/view/4.html'))
-
+
# Generate
eq_(None, m.generate(controller='content'))
eq_('/content/index/4', m.generate(controller='content', id=4))
@@ -33,20 +33,20 @@ def test_full():
m.connect('/:controller/:action/', id=None)
m.connect('/:controller/:action/:id')
m.create_regs(['content'])
-
+
# Recognize
eq_(None, m.match('/content'))
eq_(None, m.match('/content/index'))
- eq_({'controller':'content','action':'index','id':None},
+ eq_({'controller':'content','action':'index','id':None},
m.match('/content/index/'))
- eq_({'controller':'content','action':'index','id':'4'},
+ eq_({'controller':'content','action':'index','id':'4'},
m.match('/content/index/4'))
eq_({'controller':'content','action':'view','id':'4.html'},
m.match('/content/view/4.html'))
-
+
# Generate
eq_(None, m.generate(controller='content'))
-
+
# Looks odd, but only controller/action are set with non-explicit, so we
# do need the id to match
eq_('/content/index/', m.generate(controller='content', id=None))
@@ -59,7 +59,7 @@ def test_action_required():
m.explicit = True
m.connect('/:controller/index', action='index')
m.create_regs(['content'])
-
+
eq_(None, m.generate(controller='content'))
eq_(None, m.generate(controller='content', action='fred'))
eq_('/content/index', m.generate(controller='content', action='index'))
@@ -70,25 +70,25 @@ def test_query_params():
m.explicit = True
m.connect('/:controller/index', action='index')
m.create_regs(['content'])
-
+
eq_(None, m.generate(controller='content'))
- eq_('/content/index?test=sample',
+ eq_('/content/index?test=sample',
m.generate(controller='content', action='index', test='sample'))
-
+
def test_syntax():
m = Mapper(explicit=False)
m.minimization = False
m.connect('/{controller}/{action}/{id}')
m.create_regs(['content'])
-
+
# Recognize
eq_(None, m.match('/content'))
eq_(None, m.match('/content/index'))
eq_(None, m.match('/content/index/'))
- eq_({'controller':'content','action':'index','id':'4'},
+ eq_({'controller':'content','action':'index','id':'4'},
m.match('/content/index/4'))
-
+
# Generate
eq_(None, m.generate(controller='content'))
eq_('/content/index/4', m.generate(controller='content', id=4))
@@ -99,15 +99,15 @@ def test_regexp_syntax():
m.minimization = False
m.connect('/{controller}/{action}/{id:\d\d}')
m.create_regs(['content'])
-
+
# Recognize
eq_(None, m.match('/content'))
eq_(None, m.match('/content/index'))
eq_(None, m.match('/content/index/'))
eq_(None, m.match('/content/index/3'))
- eq_({'controller':'content','action':'index','id':'44'},
+ eq_({'controller':'content','action':'index','id':'44'},
m.match('/content/index/44'))
-
+
# Generate
eq_(None, m.generate(controller='content'))
eq_(None, m.generate(controller='content', id=4))
@@ -139,6 +139,6 @@ def test_other_special_chars():
m.minimization = False
m.connect('/:year/:(slug).:(format),:(locale)', locale='en', format='html')
m.create_regs(['content'])
-
+
eq_('/2007/test.xml,ja', m.generate(year=2007, slug='test', format='xml', locale='ja'))
eq_(None, m.generate(year=2007, format='html'))
diff --git a/tests/test_functional/test_recognition.py b/tests/test_functional/test_recognition.py
index 2ea2016..bec757c 100644
--- a/tests/test_functional/test_recognition.py
+++ b/tests/test_functional/test_recognition.py
@@ -9,32 +9,32 @@ from routes import *
from routes.util import RoutesException
class TestRecognition(unittest.TestCase):
-
+
def test_regexp_char_escaping(self):
m = Mapper(explicit=False)
m.minimization = True
m.connect(':controller/:(action).:(id)')
m.create_regs(['content'])
-
+
eq_({'action':'view','controller':'content','id':'2'}, m.match('/content/view.2'))
-
+
m.connect(':controller/:action/:id')
m.create_regs(['content', 'find.all'])
eq_({'action':'view','controller':'find.all','id':None}, m.match('/find.all/view'))
eq_(None, m.match('/findzall/view'))
-
+
def test_all_static(self):
m = Mapper(explicit=False)
m.minimization = True
m.connect('hello/world/how/are/you', controller='content', action='index')
m.create_regs([])
-
+
eq_(None, m.match('/x'))
eq_(None, m.match('/hello/world/how'))
eq_(None, m.match('/hello/world/how/are'))
eq_(None, m.match('/hello/world/how/are/you/today'))
eq_({'controller':'content','action':'index'}, m.match('/hello/world/how/are/you'))
-
+
def test_unicode(self):
hoge = u'\u30c6\u30b9\u30c8' # the word test in Japanese
m = Mapper(explicit=False)
@@ -42,7 +42,7 @@ class TestRecognition(unittest.TestCase):
m.connect(':hoge')
eq_({'controller': 'content', 'action': 'index', 'hoge': hoge},
m.match('/' + hoge))
-
+
def test_disabling_unicode(self):
hoge = u'\u30c6\u30b9\u30c8' # the word test in Japanese
hoge_enc = urllib.quote(hoge.encode('utf-8'))
@@ -52,21 +52,21 @@ class TestRecognition(unittest.TestCase):
m.connect(':hoge')
eq_({'controller': 'content', 'action': 'index', 'hoge': hoge_enc},
m.match('/' + hoge_enc))
-
+
def test_basic_dynamic(self):
for path in ['hi/:name', 'hi/:(name)']:
m = Mapper(explicit=False)
m.minimization = True
m.connect(path, controller='content')
m.create_regs([])
-
+
eq_(None, m.match('/boo'))
eq_(None, m.match('/boo/blah'))
eq_(None, m.match('/hi'))
eq_(None, m.match('/hi/dude/what'))
eq_({'controller':'content','name':'dude','action':'index'}, m.match('/hi/dude'))
eq_({'controller':'content','name':'dude','action':'index'}, m.match('/hi/dude/'))
-
+
def test_basic_dynamic_backwards(self):
for path in [':name/hi', ':(name)/hi']:
m = Mapper(explicit=False)
@@ -81,31 +81,31 @@ class TestRecognition(unittest.TestCase):
eq_(None, m.match('/shop/wallmart/hi'))
eq_({'name':'fred', 'action':'index', 'controller':'content'}, m.match('/fred/hi'))
eq_({'name':'index', 'action':'index', 'controller':'content'}, m.match('/index/hi'))
-
+
def test_dynamic_with_underscores(self):
m = Mapper(explicit=False)
m.minimization = True
m.connect('article/:small_page', small_page=False)
m.connect(':(controller)/:(action)/:(id)')
m.create_regs(['article', 'blog'])
-
+
eq_({'controller':'blog','action':'view','id':'0'}, m.match('/blog/view/0'))
eq_({'controller':'blog','action':'view','id':None}, m.match('/blog/view'))
-
+
def test_dynamic_with_default(self):
for path in ['hi/:action', 'hi/:(action)']:
m = Mapper(explicit=False)
m.minimization = True
m.connect(path, controller='content')
m.create_regs([])
-
+
eq_(None, m.match('/boo'))
eq_(None, m.match('/boo/blah'))
eq_(None, m.match('/hi/dude/what'))
eq_({'controller':'content','action':'index'}, m.match('/hi'))
eq_({'controller':'content','action':'index'}, m.match('/hi/index'))
eq_({'controller':'content','action':'dude'}, m.match('/hi/dude'))
-
+
def test_dynamic_with_default_backwards(self):
for path in [':action/hi', ':(action)/hi']:
m = Mapper(explicit=False)
@@ -120,21 +120,21 @@ class TestRecognition(unittest.TestCase):
eq_({'controller':'content','action':'index'}, m.match('/index/hi'))
eq_({'controller':'content','action':'index'}, m.match('/index/hi/'))
eq_({'controller':'content','action':'dude'}, m.match('/dude/hi'))
-
+
def test_dynamic_with_string_condition(self):
for path in [':name/hi', ':(name)/hi']:
m = Mapper(explicit=False)
m.minimization = True
m.connect(path, controller='content', requirements={'name':'index'})
m.create_regs([])
-
+
eq_(None, m.match('/boo'))
eq_(None, m.match('/boo/blah'))
eq_(None, m.match('/hi'))
eq_(None, m.match('/dude/what/hi'))
eq_({'controller':'content','name':'index','action':'index'}, m.match('/index/hi'))
eq_(None, m.match('/dude/hi'))
-
+
def test_dynamic_with_string_condition_backwards(self):
for path in ['hi/:name', 'hi/:(name)']:
m = Mapper(explicit=False)
@@ -148,14 +148,14 @@ class TestRecognition(unittest.TestCase):
eq_(None, m.match('/hi/dude/what'))
eq_({'controller':'content','name':'index','action':'index'}, m.match('/hi/index'))
eq_(None, m.match('/hi/dude'))
-
+
def test_dynamic_with_regexp_condition(self):
for path in ['hi/:name', 'hi/:(name)']:
m = Mapper(explicit=False)
m.minimization = True
m.connect(path, controller='content', requirements={'name':'[a-z]+'})
m.create_regs([])
-
+
eq_(None, m.match('/boo'))
eq_(None, m.match('/boo/blah'))
eq_(None, m.match('/hi'))
@@ -166,14 +166,14 @@ class TestRecognition(unittest.TestCase):
eq_(None, m.match('/hi/dude/what/'))
eq_({'controller':'content','name':'index','action':'index'}, m.match('/hi/index'))
eq_({'controller':'content','name':'dude','action':'index'}, m.match('/hi/dude'))
-
+
def test_dynamic_with_regexp_and_default(self):
for path in ['hi/:action', 'hi/:(action)']:
m = Mapper(explicit=False)
m.minimization = True
m.connect(path, controller='content', requirements={'action':'[a-z]+'})
m.create_regs([])
-
+
eq_(None, m.match('/boo'))
eq_(None, m.match('/boo/blah'))
eq_(None, m.match('/hi/FOXY'))
@@ -183,7 +183,7 @@ class TestRecognition(unittest.TestCase):
eq_({'controller':'content','action':'index'}, m.match('/hi'))
eq_({'controller':'content','action':'index'}, m.match('/hi/index'))
eq_({'controller':'content','action':'dude'}, m.match('/hi/dude'))
-
+
def test_dynamic_with_default_and_string_condition_backwards(self):
for path in [':action/hi', ':(action)/hi']:
m = Mapper(explicit=False)
@@ -206,7 +206,7 @@ class TestRecognition(unittest.TestCase):
eq_(None, m.match('/'))
eq_(None, m.match('/fred'))
-
+
def test_multiroute(self):
m = Mapper(explicit=False)
m.minimization = True
@@ -215,14 +215,14 @@ class TestRecognition(unittest.TestCase):
m.connect('viewpost/:id', controller='post', action='view')
m.connect(':controller/:action/:id')
m.create_regs(['post','blog','admin/user'])
-
+
eq_(None, m.match('/'))
eq_(None, m.match('/archive'))
eq_(None, m.match('/archive/2004/ab'))
eq_({'controller':'blog','action':'view','id':None}, m.match('/blog/view'))
- eq_({'controller':'blog','action':'view','month':None,'day':None,'year':'2004'},
+ eq_({'controller':'blog','action':'view','month':None,'day':None,'year':'2004'},
m.match('/archive/2004'))
- eq_({'controller':'blog','action':'view', 'month':'4', 'day':None,'year':'2004'},
+ eq_({'controller':'blog','action':'view', 'month':'4', 'day':None,'year':'2004'},
m.match('/archive/2004/4'))
def test_multiroute_with_nomin(self):
@@ -233,14 +233,14 @@ class TestRecognition(unittest.TestCase):
m.connect('/viewpost/:id', controller='post', action='view')
m.connect('/:controller/:action/:id')
m.create_regs(['post','blog','admin/user'])
-
+
eq_(None, m.match('/'))
eq_(None, m.match('/archive'))
eq_(None, m.match('/archive/2004/ab'))
eq_(None, m.match('/archive/2004/4'))
eq_(None, m.match('/archive/2004'))
eq_({'controller':'blog','action':'view','id':'3'}, m.match('/blog/view/3'))
- eq_({'controller':'blog','action':'view','month':'10','day':'23','year':'2004'},
+ eq_({'controller':'blog','action':'view','month':'10','day':'23','year':'2004'},
m.match('/archive/2004/10/23'))
def test_multiroute_with_splits(self):
@@ -251,16 +251,16 @@ class TestRecognition(unittest.TestCase):
m.connect('viewpost/:(id)', controller='post', action='view')
m.connect(':(controller)/:(action)/:(id)')
m.create_regs(['post','blog','admin/user'])
-
+
eq_(None, m.match('/'))
eq_(None, m.match('/archive'))
eq_(None, m.match('/archive/2004/ab'))
eq_({'controller':'blog','action':'view','id':None}, m.match('/blog/view'))
- eq_({'controller':'blog','action':'view','month':None,'day':None,'year':'2004'},
+ eq_({'controller':'blog','action':'view','month':None,'day':None,'year':'2004'},
m.match('/archive/2004'))
- eq_({'controller':'blog','action':'view', 'month':'4', 'day':None,'year':'2004'},
+ eq_({'controller':'blog','action':'view', 'month':'4', 'day':None,'year':'2004'},
m.match('/archive/2004/4'))
-
+
def test_dynamic_with_regexp_defaults_and_gaps(self):
m = Mapper()
m.minimization = True
@@ -297,21 +297,21 @@ class TestRecognition(unittest.TestCase):
m.minimization = True
m.connect(path, id=2, action='view', requirements={'id':'\d{1,2}'})
m.create_regs(['post','blog','admin/user'])
-
+
eq_(None, m.match('/'))
eq_(None, m.match('/view'))
eq_(None, m.match('/view/blog'))
eq_(None, m.match('/view/3'))
eq_(None, m.match('/view/4/honker'))
eq_({'controller':'blog','action':'view','id':'2'}, m.match('/view/2/blog'))
-
+
def test_dynamic_with_trailing_strings(self):
for path in ['view/:id/:controller/super', 'view/:(id)/:(controller)/super']:
m = Mapper()
m.minimization = True
m.connect(path, controller='blog', id=2, action='view', requirements={'id':'\d{1,2}'})
m.create_regs(['post','blog','admin/user'])
-
+
eq_(None, m.match('/'))
eq_(None, m.match('/view'))
eq_(None, m.match('/view/blah/blog/super'))
@@ -320,58 +320,58 @@ class TestRecognition(unittest.TestCase):
eq_(None, m.match('/view/4/super'))
eq_({'controller':'blog','action':'view','id':'2'}, m.match('/view/2/blog/super'))
eq_({'controller':'admin/user','action':'view','id':'4'}, m.match('/view/4/admin/user/super'))
-
+
def test_dynamic_with_trailing_non_keyword_strings(self):
m = Mapper(explicit=False)
m.minimization = True
m.connect('somewhere/:over/rainbow', controller='blog')
m.connect('somewhere/:over', controller='post')
m.create_regs(['post','blog','admin/user'])
-
+
eq_(None, m.match('/'))
eq_(None, m.match('/somewhere'))
eq_({'controller':'blog','action':'index','over':'near'}, m.match('/somewhere/near/rainbow'))
eq_({'controller':'post','action':'index','over':'tomorrow'}, m.match('/somewhere/tomorrow'))
-
+
def test_dynamic_with_trailing_dyanmic_defaults(self):
for path in ['archives/:action/:article', 'archives/:(action)/:(article)']:
m = Mapper()
m.minimization = True
m.connect(path, controller='blog')
m.create_regs(['blog'])
-
+
eq_(None, m.match('/'))
eq_(None, m.match('/archives'))
eq_(None, m.match('/archives/introduction'))
eq_(None, m.match('/archives/sample'))
eq_(None, m.match('/view/super'))
eq_(None, m.match('/view/4/super'))
- eq_({'controller':'blog','action':'view','article':'introduction'},
+ eq_({'controller':'blog','action':'view','article':'introduction'},
m.match('/archives/view/introduction'))
- eq_({'controller':'blog','action':'edit','article':'recipes'},
+ eq_({'controller':'blog','action':'edit','article':'recipes'},
m.match('/archives/edit/recipes'))
-
+
def test_path(self):
for path in ['hi/*file', 'hi/*(file)']:
m = Mapper()
m.minimization = True
m.connect(path, controller='content', action='download')
m.create_regs([])
-
+
eq_(None, m.match('/boo'))
eq_(None, m.match('/boo/blah'))
eq_(None, m.match('/hi'))
eq_({'controller':'content','action':'download','file':'books/learning_python.pdf'}, m.match('/hi/books/learning_python.pdf'))
eq_({'controller':'content','action':'download','file':'dude'}, m.match('/hi/dude'))
eq_({'controller':'content','action':'download','file':'dude/what'}, m.match('/hi/dude/what'))
-
+
def test_path_with_dynamic(self):
for path in [':controller/:action/*url', ':(controller)/:(action)/*(url)']:
m = Mapper()
m.minimization = True
m.connect(path)
m.create_regs(['content','admin/user'])
-
+
eq_(None, m.match('/'))
eq_(None, m.match('/blog'))
eq_(None, m.match('/content'))
@@ -380,15 +380,15 @@ class TestRecognition(unittest.TestCase):
eq_(None, m.match('/admin/user'))
eq_(None, m.match('/admin/user/view'))
eq_({'controller':'admin/user','action':'view','url':'blob/check'}, m.match('/admin/user/view/blob/check'))
-
-
+
+
def test_path_with_dyanmic_and_default(self):
for path in [':controller/:action/*url', ':(controller)/:(action)/*(url)']:
m = Mapper()
m.minimization = True
m.connect(path, controller='content', action='view', url=None)
m.create_regs(['content','admin/user'])
-
+
eq_(None, m.match('/goober/view/here'))
eq_({'controller':'content','action':'view','url':None}, m.match('/'))
eq_({'controller':'content','action':'view','url':None}, m.match('/content'))
@@ -397,7 +397,7 @@ class TestRecognition(unittest.TestCase):
eq_({'controller':'content','action':'view','url':'fred'}, m.match('/content/view/fred'))
eq_({'controller':'admin/user','action':'view','url':None}, m.match('/admin/user'))
eq_({'controller':'admin/user','action':'view','url':None}, m.match('/admin/user/view'))
-
+
def test_path_with_dynamic_and_default_backwards(self):
for path in ['*file/login', '*(file)/login']:
m = Mapper()
@@ -411,21 +411,21 @@ class TestRecognition(unittest.TestCase):
eq_({'controller':'content','action':'download','file':'books/learning_python.pdf'}, m.match('/books/learning_python.pdf/login'))
eq_({'controller':'content','action':'download','file':'dude'}, m.match('/dude/login'))
eq_({'controller':'content','action':'download','file':'dude/what'}, m.match('/dude/what/login'))
-
+
def test_path_backwards(self):
for path in ['*file/login', '*(file)/login']:
m = Mapper()
m.minimization = True
m.connect(path, controller='content', action='download')
m.create_regs([])
-
+
eq_(None, m.match('/boo'))
eq_(None, m.match('/boo/blah'))
eq_(None, m.match('/login'))
eq_({'controller':'content','action':'download','file':'books/learning_python.pdf'}, m.match('/books/learning_python.pdf/login'))
eq_({'controller':'content','action':'download','file':'dude'}, m.match('/dude/login'))
eq_({'controller':'content','action':'download','file':'dude/what'}, m.match('/dude/what/login'))
-
+
def test_path_backwards_with_controller(self):
m = Mapper()
m.minimization = True
@@ -439,12 +439,12 @@ class TestRecognition(unittest.TestCase):
eq_({'controller':'content','action':'check_access','url':'books/learning_python.pdf'}, m.match('/books/learning_python.pdf/login'))
eq_({'controller':'content','action':'check_access','url':'dude'}, m.match('/dude/login'))
eq_({'controller':'content','action':'check_access','url':'dude/what'}, m.match('/dude/what/login'))
-
+
eq_(None, m.match('/admin/user'))
eq_({'controller':'admin/user','action':'view','url':'books/learning_python.pdf'}, m.match('/books/learning_python.pdf/admin/user'))
eq_({'controller':'admin/user','action':'view','url':'dude'}, m.match('/dude/admin/user'))
eq_({'controller':'admin/user','action':'view','url':'dude/what'}, m.match('/dude/what/admin/user'))
-
+
def test_path_backwards_with_controller_and_splits(self):
m = Mapper()
m.minimization = True
@@ -458,18 +458,18 @@ class TestRecognition(unittest.TestCase):
eq_({'controller':'content','action':'check_access','url':'books/learning_python.pdf'}, m.match('/books/learning_python.pdf/login'))
eq_({'controller':'content','action':'check_access','url':'dude'}, m.match('/dude/login'))
eq_({'controller':'content','action':'check_access','url':'dude/what'}, m.match('/dude/what/login'))
-
+
eq_(None, m.match('/admin/user'))
eq_({'controller':'admin/user','action':'view','url':'books/learning_python.pdf'}, m.match('/books/learning_python.pdf/admin/user'))
eq_({'controller':'admin/user','action':'view','url':'dude'}, m.match('/dude/admin/user'))
eq_({'controller':'admin/user','action':'view','url':'dude/what'}, m.match('/dude/what/admin/user'))
-
+
def test_controller(self):
m = Mapper()
m.minimization = True
m.connect('hi/:controller', action='hi')
m.create_regs(['content','admin/user'])
-
+
eq_(None, m.match('/boo'))
eq_(None, m.match('/boo/blah'))
eq_(None, m.match('/hi/13870948'))
@@ -478,13 +478,13 @@ class TestRecognition(unittest.TestCase):
eq_(None, m.match('/hi/admin/user/foo/'))
eq_({'controller':'content','action':'hi'}, m.match('/hi/content'))
eq_({'controller':'admin/user', 'action':'hi'}, m.match('/hi/admin/user'))
-
+
def test_standard_route(self):
m = Mapper(explicit=False)
m.minimization = True
m.connect(':controller/:action/:id')
m.create_regs(['content','admin/user'])
-
+
eq_({'controller':'content','action':'index', 'id': None}, m.match('/content'))
eq_({'controller':'content','action':'list', 'id':None}, m.match('/content/list'))
eq_({'controller':'content','action':'show','id':'10'}, m.match('/content/show/10'))
@@ -495,13 +495,13 @@ class TestRecognition(unittest.TestCase):
eq_(None, m.match('/content/show/10/20'))
eq_(None, m.match('/food'))
-
+
def test_standard_route_with_gaps(self):
m = Mapper()
m.minimization = True
m.connect(':controller/:action/:(id).py')
m.create_regs(['content','admin/user'])
-
+
eq_({'controller':'content','action':'index', 'id': 'None'}, m.match('/content/index/None.py'))
eq_({'controller':'content','action':'list', 'id':'None'}, m.match('/content/list/None.py'))
eq_({'controller':'content','action':'show','id':'10'}, m.match('/content/show/10.py'))
@@ -512,35 +512,35 @@ class TestRecognition(unittest.TestCase):
m.connect('manage/:domain.:ext', controller='admin/user', action='view', ext='html')
m.connect(':controller/:action/:id')
m.create_regs(['content','admin/user'])
-
+
eq_({'controller':'content','action':'index', 'id': 'None.py'}, m.match('/content/index/None.py'))
eq_({'controller':'content','action':'list', 'id':'None.py'}, m.match('/content/list/None.py'))
eq_({'controller':'content','action':'show','id':'10.py'}, m.match('/content/show/10.py'))
eq_({'controller':'content','action':'show.all','id':'10.py'}, m.match('/content/show.all/10.py'))
eq_({'controller':'content','action':'show','id':'www.groovie.org'}, m.match('/content/show/www.groovie.org'))
-
+
eq_({'controller':'admin/user','action':'view', 'ext': 'html', 'domain': 'groovie'}, m.match('/manage/groovie'))
eq_({'controller':'admin/user','action':'view', 'ext': 'xml', 'domain': 'groovie'}, m.match('/manage/groovie.xml'))
-
+
def test_standard_with_domains(self):
m = Mapper()
m.minimization = True
m.connect('manage/:domain', controller='domains', action='view')
m.create_regs(['domains'])
-
+
eq_({'controller':'domains','action':'view','domain':'www.groovie.org'}, m.match('/manage/www.groovie.org'))
-
+
def test_default_route(self):
m = Mapper()
m.minimization = True
m.connect('',controller='content',action='index')
m.create_regs(['content'])
-
+
eq_(None, m.match('/x'))
eq_(None, m.match('/hello/world'))
eq_(None, m.match('/hello/world/how/are'))
eq_(None, m.match('/hello/world/how/are/you/today'))
-
+
eq_({'controller':'content','action':'index'}, m.match('/'))
def test_dynamic_with_prefix(self):
@@ -555,13 +555,13 @@ class TestRecognition(unittest.TestCase):
eq_(None, m.match('/admin/comments'))
eq_(None, m.match('/content/view'))
eq_(None, m.match('/archive/view/4'))
-
+
eq_({'controller':'content','action':'index'}, m.match('/blog'))
eq_({'controller':'content','action':'index','id':None}, m.match('/blog/content'))
eq_({'controller':'admin/comments','action':'view','id':None}, m.match('/blog/admin/comments/view'))
eq_({'controller':'archive','action':'index','id':None}, m.match('/blog/archive'))
eq_({'controller':'archive','action':'view', 'id':'4'}, m.match('/blog/archive/view/4'))
-
+
def test_dynamic_with_multiple_and_prefix(self):
m = Mapper(explicit=False)
m.minimization = True
@@ -575,15 +575,15 @@ class TestRecognition(unittest.TestCase):
eq_(None, m.match('/admin/comments'))
eq_(None, m.match('/content/view'))
eq_(None, m.match('/archive/view/4'))
-
+
eq_({'controller':'content', 'action':'index'}, m.match('/blog/'))
eq_({'controller':'archive', 'action':'view'}, m.match('/blog/home/view'))
eq_({'controller':'content','action':'index','id':None}, m.match('/blog/content'))
eq_({'controller':'admin/comments','action':'view','id':None}, m.match('/blog/admin/comments/view'))
eq_({'controller':'archive','action':'index','id':None}, m.match('/blog/archive'))
eq_({'controller':'archive','action':'view', 'id':'4'}, m.match('/blog/archive/view/4'))
-
-
+
+
def test_splits_with_extension(self):
m = Mapper()
m.minimization = True
@@ -596,23 +596,23 @@ class TestRecognition(unittest.TestCase):
eq_(None, m.match('/hi'))
eq_({'controller':'content','action':'index'}, m.match('/hi/index.html'))
eq_({'controller':'content','action':'dude'}, m.match('/hi/dude.html'))
-
+
def test_splits_with_dashes(self):
m = Mapper()
m.minimization = True
m.connect('archives/:(year)-:(month)-:(day).html', controller='archives', action='view')
m.create_regs([])
-
+
eq_(None, m.match('/boo'))
eq_(None, m.match('/archives'))
-
+
eq_({'controller':'archives','action':'view','year':'2004','month':'12','day':'4'},
m.match('/archives/2004-12-4.html'))
eq_({'controller':'archives','action':'view','year':'04','month':'10','day':'4'},
m.match('/archives/04-10-4.html'))
eq_({'controller':'archives','action':'view','year':'04','month':'1','day':'1'},
m.match('/archives/04-1-1.html'))
-
+
def test_splits_packed_with_regexps(self):
m = Mapper()
m.minimization = True
@@ -637,49 +637,49 @@ class TestRecognition(unittest.TestCase):
m.minimization = True
m.connect(':name/:(action)-:(day)', controller='content')
m.create_regs([])
-
+
eq_(None, m.match('/something'))
eq_(None, m.match('/something/is-'))
-
+
eq_({'controller':'content','action':'view','day':'3','name':'group'},
m.match('/group/view-3'))
eq_({'controller':'content','action':'view','day':'5','name':'group'},
m.match('/group/view-5'))
-
+
def test_splits_with_slashes_and_default(self):
m = Mapper(explicit=False)
m.minimization = True
m.connect(':name/:(action)-:(id)', controller='content')
m.create_regs([])
-
+
eq_(None, m.match('/something'))
eq_(None, m.match('/something/is'))
-
+
eq_({'controller':'content','action':'view','id':'3','name':'group'},
m.match('/group/view-3'))
eq_({'controller':'content','action':'view','id':None,'name':'group'},
m.match('/group/view-'))
-
+
def test_no_reg_make(self):
m = Mapper()
m.connect(':name/:(action)-:(id)', controller='content')
m.controller_scan = False
def call_func():
m.match('/group/view-3')
- assert_raises(RoutesException, call_func)
-
+ assert_raises(RoutesException, call_func)
+
def test_routematch(self):
m = Mapper(explicit=False)
m.minimization = True
m.connect(':controller/:action/:id')
m.create_regs(['content'])
route = m.matchlist[0]
-
+
resultdict, route_obj = m.routematch('/content')
eq_({'action':'index', 'controller':'content','id':None}, resultdict)
eq_(route, route_obj)
eq_(None, m.routematch('/nowhere'))
-
+
def test_routematch_debug(self):
m = Mapper(explicit=False)
m.minimization = True
@@ -687,7 +687,7 @@ class TestRecognition(unittest.TestCase):
m.debug = True
m.create_regs(['content'])
route = m.matchlist[0]
-
+
resultdict, route_obj, debug = m.routematch('/content')
eq_({'action':'index', 'controller':'content','id':None}, resultdict)
eq_(route, route_obj)
@@ -695,7 +695,7 @@ class TestRecognition(unittest.TestCase):
eq_(None, resultdict)
eq_(None, route_obj)
eq_(len(debug), 0)
-
+
def test_match_debug(self):
m = Mapper(explicit=False)
m.minimization = True
@@ -704,7 +704,7 @@ class TestRecognition(unittest.TestCase):
m.debug = True
m.create_regs(['content'])
route = m.matchlist[0]
-
+
resultdict, route_obj, debug = m.match('/content')
eq_({'action':'index', 'controller':'content','id':None}, resultdict)
eq_(route, route_obj)
@@ -712,98 +712,98 @@ class TestRecognition(unittest.TestCase):
eq_(None, resultdict)
eq_(route_obj, None)
eq_(len(debug), 0)
-
+
def test_conditions(self):
m = Mapper(explicit=False)
m.minimization = True
m.connect('home/upload', controller='content', action='upload', conditions=dict(method=['POST']))
m.connect(':controller/:action/:id')
m.create_regs(['content', 'blog'])
-
+
con = request_config()
con.mapper = m
env = dict(PATH_INFO='/nowhere', HTTP_HOST='example.com', REQUEST_METHOD='GET')
con.mapper_dict = {}
con.environ = env
eq_(None, con.mapper_dict)
-
+
env['PATH_INFO'] = '/content'
con.environ = env
eq_({'action':'index','controller':'content','id':None}, con.mapper_dict)
-
+
env['PATH_INFO'] = '/home/upload'
con.environ = env
eq_(None, con.mapper_dict)
-
+
env['REQUEST_METHOD'] = 'POST'
con.environ = env
eq_({'action':'upload','controller':'content'}, con.mapper_dict)
-
+
def test_subdomains(self):
m = Mapper(explicit=False)
m.minimization = True
m.sub_domains = True
m.connect(':controller/:action/:id')
m.create_regs(['content', 'blog'])
-
+
con = request_config()
con.mapper = m
env = dict(PATH_INFO='/nowhere', HTTP_HOST='example.com')
con.mapper_dict = {}
con.environ = env
-
+
eq_(None, con.mapper_dict)
-
+
env['PATH_INFO'] = '/content'
con.environ = env
eq_({'action': 'index', 'controller': 'content', 'sub_domain': None, 'id': None},
con.mapper_dict)
-
+
env['HTTP_HOST'] = 'fred.example.com'
con.environ = env
eq_({'action': 'index', 'controller': 'content', 'sub_domain': 'fred', 'id': None},
con.mapper_dict)
-
+
env['HTTP_HOST'] = 'www.example.com'
con.environ = env
eq_({'action': 'index', 'controller': 'content', 'sub_domain': 'www', 'id': None},
con.mapper_dict)
-
+
def test_subdomains_with_conditions(self):
m = Mapper(explicit=False)
m.minimization = True
m.sub_domains = True
m.connect(':controller/:action/:id')
m.create_regs(['content', 'blog'])
-
+
con = request_config()
con.mapper = m
env = dict(PATH_INFO='/nowhere', HTTP_HOST='example.com')
con.mapper_dict = {}
con.environ = env
-
+
eq_(None, con.mapper_dict)
-
+
env['PATH_INFO'] = '/content'
con.environ = env
eq_({'action': 'index', 'controller': 'content', 'sub_domain': None, 'id': None},
con.mapper_dict)
-
+
m.connect('', controller='users', action='home', conditions={'sub_domain':True})
m.create_regs(['content', 'users', 'blog'])
env['PATH_INFO'] = '/'
con.environ = env
eq_(None, con.mapper_dict)
-
+
env['HTTP_HOST'] = 'fred.example.com'
con.environ = env
eq_({'action': 'home', 'controller': 'users', 'sub_domain': 'fred'}, con.mapper_dict)
-
+
m.sub_domains_ignore = ['www']
env['HTTP_HOST'] = 'www.example.com'
con.environ = env
eq_(None, con.mapper_dict)
-
+
def test_subdomain_with_conditions2(self):
m = Mapper()
m.minimization = True
@@ -815,24 +815,24 @@ class TestRecognition(unittest.TestCase):
conditions={'sub_domain':False})
m.connect('admin/view', controller='admin', action='view')
m.create_regs(['content', 'blog_admin', 'admin'])
-
+
con = request_config()
con.mapper = m
env = dict(PATH_INFO='/nowhere', HTTP_HOST='example.com')
con.mapper_dict = {}
con.environ = env
-
+
eq_(None, con.mapper_dict)
-
+
env['PATH_INFO'] = '/admin/comments'
con.environ = env
eq_({'action': 'comments', 'controller':'blog_admin', 'sub_domain': None}, con.mapper_dict)
-
+
env['PATH_INFO'] = '/admin/view'
env['HTTP_HOST'] = 'fred.example.com'
con.environ = env
eq_({'action': 'view', 'controller':'admin', 'sub_domain': 'fred'}, con.mapper_dict)
-
+
def test_subdomains_with_ignore(self):
m = Mapper(explicit=False)
m.minimization = True
@@ -840,30 +840,30 @@ class TestRecognition(unittest.TestCase):
m.sub_domains_ignore = ['www']
m.connect(':controller/:action/:id')
m.create_regs(['content', 'blog'])
-
+
con = request_config()
con.mapper = m
env = dict(PATH_INFO='/nowhere', HTTP_HOST='example.com')
con.mapper_dict = {}
con.environ = env
-
+
eq_(None, con.mapper_dict)
-
+
env['PATH_INFO'] = '/content'
con.environ = env
eq_({'action': 'index', 'controller': 'content', 'sub_domain': None, 'id': None},
con.mapper_dict)
-
+
env['HTTP_HOST'] = 'fred.example.com'
con.environ = env
eq_({'action': 'index', 'controller': 'content', 'sub_domain': 'fred', 'id': None},
con.mapper_dict)
-
+
env['HTTP_HOST'] = 'www.example.com'
con.environ = env
eq_({'action': 'index', 'controller': 'content', 'sub_domain': None, 'id': None},
con.mapper_dict)
-
+
def test_other_special_chars(self):
m = Mapper(explicit=False)
m.minimization = True
@@ -884,32 +884,32 @@ class TestRecognition(unittest.TestCase):
eq_(None, m.match('/2007/test.'))
eq_({'controller': 'error', 'action': 'img',
'id': 'icon-16.png'}, m.match('/error/img/icon-16.png'))
-
+
def test_various_periods(self):
m = Mapper(explicit=False)
m.minimization = True
m.connect('sites/:site/pages/:page')
m.create_regs(['content'])
-
- eq_({'action': u'index', 'controller': u'content',
- 'site': u'python.com', 'page': u'index.html'},
+
+ eq_({'action': u'index', 'controller': u'content',
+ 'site': u'python.com', 'page': u'index.html'},
m.match('/sites/python.com/pages/index.html'))
m = Mapper(explicit=False)
m.minimization = True
m.connect('sites/:site/pages/:page.:format', format='html')
m.create_regs(['content'])
-
- eq_({'action': u'index', 'controller': u'content',
- 'site': u'python.com', 'page': u'index', 'format': u'html'},
+
+ eq_({'action': u'index', 'controller': u'content',
+ 'site': u'python.com', 'page': u'index', 'format': u'html'},
m.match('/sites/python.com/pages/index.html'))
-
+
def test_empty_fails(self):
m = Mapper(explicit=False)
m.minimization = True
m.connect(':controller/:action/:id')
m.connect('', controller='content', action='view', id=4)
m.create_regs(['content'])
-
+
eq_({'controller':'content','action':'index','id':None}, m.match('/content'))
eq_({'controller':'content','action':'view','id':'4'}, m.match('/'))
def call_func():
@@ -922,20 +922,20 @@ class TestRecognition(unittest.TestCase):
m.explicit = True
m.connect('')
m.create_regs([])
-
+
eq_(None, m.match('/content'))
eq_({}, m.match('/'))
def call_func():
m.match('')
assert_raises(RoutesException, call_func)
-
+
def test_dot_format_args(self):
for minimization in [False, True]:
m = Mapper(explicit=True)
m.minimization=minimization
m.connect('/songs/{title}{.format}')
m.connect('/stories/{slug:[^./]+?}{.format:pdf}')
-
+
eq_({'title': 'my-way', 'format': None}, m.match('/songs/my-way'))
eq_({'title': 'my-way', 'format': 'mp3'}, m.match('/songs/my-way.mp3'))
eq_({'slug': 'frist-post', 'format': None}, m.match('/stories/frist-post'))
@@ -973,11 +973,11 @@ else:
a = m.match('/admin/comments/article/42/show/52')
a = m.match('/admin/content/view/5')
a = m.match('/index.rdf')
-
+
a = m.match('/xml/view/feed.xml')
a = m.match('/xml/articlerss/42/feed.xml')
a = m.match('/articles')
-
+
a = m.match('/articles/2004/12/20/page/2')
a = m.match('/articles/category/42')
a = m.match('/pages/this/is/long')
@@ -992,7 +992,7 @@ else:
print "Recognition\n"
print "%s ms/url" % (per_url*1000)
print "%s urls/s\n" % (1.00/per_url)
-
+
"""
Copyright (c) 2005 Ben Bangert <ben@groovie.org>, Parachute
All rights reserved.
diff --git a/tests/test_functional/test_resources.py b/tests/test_functional/test_resources.py
index 9fd7ab9..06bebcd 100644
--- a/tests/test_functional/test_resources.py
+++ b/tests/test_functional/test_resources.py
@@ -13,11 +13,11 @@ class TestResourceGeneration(unittest.TestCase):
eq_(baseroute + '/1', m.generate(action='show', id='1', **options))
eq_(baseroute + '/1/edit', m.generate(action='edit',id='1', **options))
eq_(baseroute + '/1.xml', m.generate(action='show', id='1',format='xml', **options))
-
+
eq_(baseroute, m.generate(action='create', method='post', **options))
eq_(baseroute + '/1', m.generate(action='update', method='put', id='1', **options))
eq_(baseroute + '/1', m.generate(action='delete', method='delete', id='1', **options))
-
+
def test_resources(self):
m = Mapper()
m.resource('message', 'messages')
@@ -34,14 +34,14 @@ class TestResourceGeneration(unittest.TestCase):
eq_('/messages/1/edit', url_for('edit_message', id=1))
eq_('/messages/1/edit.xml', url_for('formatted_edit_message', id=1, format='xml'))
self._assert_restful_routes(m, options)
-
+
def test_resources_with_path_prefix(self):
m = Mapper()
m.resource('message', 'messages', path_prefix='/thread/:threadid')
m.create_regs(['messages'])
options = dict(controller='messages', threadid='5')
self._assert_restful_routes(m, options, path_prefix='thread/5/')
-
+
def test_resources_with_collection_action(self):
m = Mapper()
m.resource('message', 'messages', collection=dict(rss='GET'))
@@ -52,7 +52,7 @@ class TestResourceGeneration(unittest.TestCase):
eq_('/messages/rss', url_for('rss_messages'))
eq_('/messages/rss.xml', m.generate(controller='messages', action='rss', format='xml'))
eq_('/messages/rss.xml', url_for('formatted_rss_messages', format='xml'))
-
+
def test_resources_with_member_action(self):
for method in ['put', 'post']:
m = Mapper()
@@ -61,9 +61,9 @@ class TestResourceGeneration(unittest.TestCase):
options = dict(controller='messages')
self._assert_restful_routes(m, options)
eq_('/messages/1/mark', m.generate(method=method, action='mark', id='1', **options))
- eq_('/messages/1/mark.xml',
+ eq_('/messages/1/mark.xml',
m.generate(method=method, action='mark', id='1', format='xml', **options))
-
+
def test_resources_with_new_action(self):
m = Mapper()
m.resource('message', 'messages/', new=dict(preview='POST'))
@@ -72,10 +72,10 @@ class TestResourceGeneration(unittest.TestCase):
self._assert_restful_routes(m, options)
eq_('/messages/new/preview', m.generate(controller='messages', action='preview', method='post'))
eq_('/messages/new/preview', url_for('preview_new_message'))
- eq_('/messages/new/preview.xml',
+ eq_('/messages/new/preview.xml',
m.generate(controller='messages', action='preview', method='post', format='xml'))
eq_('/messages/new/preview.xml', url_for('formatted_preview_new_message', format='xml'))
-
+
def test_resources_with_name_prefix(self):
m = Mapper()
m.resource('message', 'messages', name_prefix='category_', new=dict(preview='POST'))
@@ -91,29 +91,29 @@ class TestResourceRecognition(unittest.TestCase):
m = Mapper()
m.resource('person', 'people')
m.create_regs(['people'])
-
+
con = request_config()
con.mapper = m
def test_path(path, method):
env = dict(HTTP_HOST='example.com', PATH_INFO=path, REQUEST_METHOD=method)
con.mapper_dict = {}
con.environ = env
-
+
test_path('/people', 'GET')
eq_({'controller':'people', 'action':'index'}, con.mapper_dict)
test_path('/people.xml', 'GET')
eq_({'controller':'people', 'action':'index', 'format':'xml'}, con.mapper_dict)
-
+
test_path('/people', 'POST')
eq_({'controller':'people', 'action':'create'}, con.mapper_dict)
test_path('/people.html', 'POST')
eq_({'controller':'people', 'action':'create', 'format':'html'}, con.mapper_dict)
-
+
test_path('/people/2.xml', 'GET')
eq_({'controller':'people', 'action':'show', 'id':'2', 'format':'xml'}, con.mapper_dict)
test_path('/people/2', 'GET')
eq_({'controller':'people', 'action':'show', 'id':'2'}, con.mapper_dict)
-
+
test_path('/people/2/edit', 'GET')
eq_({'controller':'people', 'action':'edit', 'id':'2'}, con.mapper_dict)
test_path('/people/2/edit.xml', 'GET')
@@ -154,20 +154,20 @@ class TestResourceRecognition(unittest.TestCase):
m.minimization = False
m.resource('person', 'people')
m.create_regs(['people'])
-
+
con = request_config()
con.mapper = m
def test_path(path, method):
env = dict(HTTP_HOST='example.com', PATH_INFO=path, REQUEST_METHOD=method)
con.mapper_dict = {}
con.environ = env
-
+
test_path('/people', 'GET')
eq_({'controller':'people', 'action':'index'}, con.mapper_dict)
-
+
test_path('/people', 'POST')
eq_({'controller':'people', 'action':'create'}, con.mapper_dict)
-
+
test_path('/people/2', 'GET')
eq_({'controller':'people', 'action':'show', 'id':'2'}, con.mapper_dict)
test_path('/people/2/edit', 'GET')
@@ -179,13 +179,13 @@ class TestResourceRecognition(unittest.TestCase):
test_path('/people/2', 'PUT')
eq_({'controller':'people', 'action':'update', 'id':'2'}, con.mapper_dict)
- def test_resource_created_with_parent_resource(self):
+ def test_resource_created_with_parent_resource(self):
m = Mapper()
m.resource('location', 'locations',
parent_resource=dict(member_name='region',
collection_name='regions'))
m.create_regs(['locations'])
-
+
con = request_config()
con.mapper = m
def test_path(path, method):
@@ -193,13 +193,13 @@ class TestResourceRecognition(unittest.TestCase):
REQUEST_METHOD=method)
con.mapper_dict = {}
con.environ = env
-
+
test_path('/regions/13/locations', 'GET')
eq_(con.mapper_dict, {'region_id': '13', 'controller': 'locations',
'action': 'index'})
url = url_for('region_locations', region_id=13)
eq_(url, '/regions/13/locations')
-
+
test_path('/regions/13/locations', 'POST')
eq_(con.mapper_dict, {'region_id': '13', 'controller': 'locations',
'action': 'create'})
@@ -209,31 +209,31 @@ class TestResourceRecognition(unittest.TestCase):
# create
url = url_for('region_locations', region_id=13)
eq_(url, '/regions/13/locations')
-
+
test_path('/regions/13/locations/60', 'GET')
eq_(con.mapper_dict, {'region_id': '13', 'controller': 'locations',
'id': '60', 'action': 'show'})
url = url_for('region_location', region_id=13, id=60)
eq_(url, '/regions/13/locations/60')
-
+
test_path('/regions/13/locations/60/edit', 'GET')
eq_(con.mapper_dict, {'region_id': '13', 'controller': 'locations',
'id': '60', 'action': 'edit'})
url = url_for('region_edit_location', region_id=13, id=60)
eq_(url, '/regions/13/locations/60/edit')
-
+
test_path('/regions/13/locations/60', 'DELETE')
eq_(con.mapper_dict, {'region_id': '13', 'controller': 'locations',
'id': '60', 'action': 'delete'})
url = url_for('region_location', region_id=13, id=60)
eq_(url, '/regions/13/locations/60')
-
+
test_path('/regions/13/locations/60', 'PUT')
eq_(con.mapper_dict, {'region_id': '13', 'controller': 'locations',
'id': '60', 'action': 'update'})
url = url_for('region_location', region_id=13, id=60)
eq_(url, '/regions/13/locations/60')
-
+
# Make sure ``path_prefix`` overrides work
# empty ``path_prefix`` (though I'm not sure why someone would do this)
m = Mapper()
@@ -299,14 +299,14 @@ class TestResourceRecognition(unittest.TestCase):
url = url_for('place_locations', area_id=51)
eq_(url, '/areas/51/locations')
- def test_resource_created_with_parent_resource_nomin(self):
+ def test_resource_created_with_parent_resource_nomin(self):
m = Mapper()
m.minimization = False
m.resource('location', 'locations',
parent_resource=dict(member_name='region',
collection_name='regions'))
m.create_regs(['locations'])
-
+
con = request_config()
con.mapper = m
def test_path(path, method):
@@ -314,13 +314,13 @@ class TestResourceRecognition(unittest.TestCase):
REQUEST_METHOD=method)
con.mapper_dict = {}
con.environ = env
-
+
test_path('/regions/13/locations', 'GET')
eq_(con.mapper_dict, {'region_id': '13', 'controller': 'locations',
'action': 'index'})
url = url_for('region_locations', region_id=13)
eq_(url, '/regions/13/locations')
-
+
test_path('/regions/13/locations', 'POST')
eq_(con.mapper_dict, {'region_id': '13', 'controller': 'locations',
'action': 'create'})
@@ -330,31 +330,31 @@ class TestResourceRecognition(unittest.TestCase):
# create
url = url_for('region_locations', region_id=13)
eq_(url, '/regions/13/locations')
-
+
test_path('/regions/13/locations/60', 'GET')
eq_(con.mapper_dict, {'region_id': '13', 'controller': 'locations',
- 'id': '60', 'action': 'show'})
- url = url_for('region_location', region_id=13, id=60)
- eq_(url, '/regions/13/locations/60')
-
- test_path('/regions/13/locations/60/edit', 'GET')
+ 'id': '60', 'action': 'show'})
+ url = url_for('region_location', region_id=13, id=60)
+ eq_(url, '/regions/13/locations/60')
+
+ test_path('/regions/13/locations/60/edit', 'GET')
eq_(con.mapper_dict, {'region_id': '13', 'controller': 'locations',
- 'id': '60', 'action': 'edit'})
- url = url_for('region_edit_location', region_id=13, id=60)
- eq_(url, '/regions/13/locations/60/edit')
-
- test_path('/regions/13/locations/60', 'DELETE')
+ 'id': '60', 'action': 'edit'})
+ url = url_for('region_edit_location', region_id=13, id=60)
+ eq_(url, '/regions/13/locations/60/edit')
+
+ test_path('/regions/13/locations/60', 'DELETE')
eq_(con.mapper_dict, {'region_id': '13', 'controller': 'locations',
- 'id': '60', 'action': 'delete'})
- url = url_for('region_location', region_id=13, id=60)
- eq_(url, '/regions/13/locations/60')
-
- test_path('/regions/13/locations/60', 'PUT')
+ 'id': '60', 'action': 'delete'})
+ url = url_for('region_location', region_id=13, id=60)
+ eq_(url, '/regions/13/locations/60')
+
+ test_path('/regions/13/locations/60', 'PUT')
eq_(con.mapper_dict, {'region_id': '13', 'controller': 'locations',
'id': '60', 'action': 'update'})
url = url_for('region_location', region_id=13, id=60)
eq_(url, '/regions/13/locations/60')
-
+
# Make sure ``path_prefix`` overrides work
# empty ``path_prefix`` (though I'm not sure why someone would do this)
m = Mapper()
@@ -420,7 +420,7 @@ class TestResourceRecognition(unittest.TestCase):
url = url_for('place_locations', area_id=51)
eq_(url, '/areas/51/locations')
-
+
if __name__ == '__main__':
unittest.main()
diff --git a/tests/test_functional/test_submapper.py b/tests/test_functional/test_submapper.py
index 1df97a6..3576859 100644
--- a/tests/test_functional/test_submapper.py
+++ b/tests/test_functional/test_submapper.py
@@ -9,7 +9,7 @@ class TestSubmapper(unittest.TestCase):
m = Mapper()
c = m.submapper(path_prefix='/entries', requirements=dict(id='\d+'))
c.connect('entry', '/{id}')
-
+
eq_('/entries/1', url_for('entry', id=1))
assert_raises(Exception, url_for, 'entry', id='foo')
@@ -18,10 +18,10 @@ class TestSubmapper(unittest.TestCase):
c = m.submapper(path_prefix='/entries', controller='entry',
requirements=dict(id='\d+'))
e = c.submapper(path_prefix='/{id}')
-
+
eq_('entry', c.resource_name)
eq_('entry', e.resource_name)
-
+
e.connect('entry', '')
e.connect('edit_entry', '/edit')
@@ -35,7 +35,7 @@ class TestSubmapper(unittest.TestCase):
c.action(name='entries', action='list')
c.action(action='create', method='POST')
-
+
eq_('/entries', url_for('entries', method='GET'))
eq_('/entries', url_for('create_entry', method='POST'))
eq_('/entries', url_for(controller='entry', action='list', method='GET'))
@@ -45,10 +45,10 @@ class TestSubmapper(unittest.TestCase):
def test_submapper_link(self):
m = Mapper(explicit=True)
c = m.submapper(path_prefix='/entries', controller='entry')
-
+
c.link(rel='new')
c.link(rel='ping', method='POST')
-
+
eq_('/entries/new', url_for('new_entry', method='GET'))
eq_('/entries/ping', url_for('ping_entry', method='POST'))
eq_('/entries/new', url_for(controller='entry', action='new', method='GET'))
@@ -61,7 +61,7 @@ class TestSubmapper(unittest.TestCase):
c = m.submapper(path_prefix='/entries', collection_name='entries',
controller='entry')
e = c.submapper(path_prefix='/{id}')
-
+
c.index()
c.create()
e.show()
@@ -71,7 +71,7 @@ class TestSubmapper(unittest.TestCase):
eq_('/entries', url_for('entries', method='GET'))
eq_('/entries', url_for('create_entry', method='POST'))
assert_raises(Exception, url_for, 'entries', method='DELETE')
-
+
eq_('/entries/1', url_for('entry', id=1, method='GET'))
eq_('/entries/1', url_for('update_entry', id=1, method='PUT'))
eq_('/entries/1', url_for('delete_entry', id=1, method='DELETE'))
@@ -81,13 +81,13 @@ class TestSubmapper(unittest.TestCase):
m = Mapper()
c = m.submapper(path_prefix='/entries', controller='entry')
e = c.submapper(path_prefix='/{id}')
-
+
c.new()
e.edit()
eq_('/entries/new', url_for('new_entry', method='GET'))
assert_raises(Exception, url_for, 'new_entry', method='POST')
-
+
eq_('/entries/1/edit', url_for('edit_entry', id=1, method='GET'))
assert_raises(Exception, url_for, 'edit_entry', id=1, method='POST')
@@ -102,7 +102,7 @@ class TestSubmapper(unittest.TestCase):
eq_('/entries', url_for('entries', method='GET'))
eq_('/entries', url_for('create_entry', method='POST'))
assert_raises(Exception, url_for, 'entries', method='DELETE')
-
+
eq_('/entries/1', url_for('entry', id=1, method='GET'))
eq_('/entries/1', url_for('update_entry', id=1, method='PUT'))
eq_('/entries/1', url_for('delete_entry', id=1, method='DELETE'))
@@ -110,7 +110,7 @@ class TestSubmapper(unittest.TestCase):
eq_('/entries/new', url_for('new_entry', method='GET'))
assert_raises(Exception, url_for, 'new_entry', method='POST')
-
+
eq_('/entries/1/edit', url_for('edit_entry', id=1, method='GET'))
assert_raises(Exception, url_for, 'edit_entry', id=1, method='POST')
@@ -121,7 +121,7 @@ class TestSubmapper(unittest.TestCase):
eq_('/entries', url_for('entries', method='GET'))
eq_('/entries', url_for('create_entry', method='POST'))
assert_raises(Exception, url_for, 'entries', method='DELETE')
-
+
eq_('/entries/1', url_for('entry', id=1, method='GET'))
eq_('/entries/1', url_for('update_entry', id=1, method='PUT'))
eq_('/entries/1', url_for('delete_entry', id=1, method='DELETE'))
@@ -129,7 +129,7 @@ class TestSubmapper(unittest.TestCase):
eq_('/entries/new', url_for('new_entry', method='GET'))
assert_raises(Exception, url_for, 'new_entry', method='POST')
-
+
eq_('/entries/1/edit', url_for('edit_entry', id=1, method='GET'))
assert_raises(Exception, url_for, 'edit_entry', id=1, method='POST')
diff --git a/tests/test_functional/test_utils.py b/tests/test_functional/test_utils.py
index e952baf..1f7d67e 100644
--- a/tests/test_functional/test_utils.py
+++ b/tests/test_functional/test_utils.py
@@ -20,11 +20,11 @@ class TestUtils(unittest.TestCase):
if hasattr(con, 'environ'):
del con.environ
self.con = con
-
+
def test_url_for_with_nongen(self):
con = self.con
con.mapper_dict = {}
-
+
eq_('/blog', url_for('/blog'))
eq_('/blog?q=fred&q=here%20now', url_for('/blog', q=['fred', u'here now']))
eq_('/blog#here', url_for('/blog', anchor='here'))
@@ -33,36 +33,36 @@ class TestUtils(unittest.TestCase):
con = self.con
con.mapper_dict = {}
con.mapper.encoding = None
-
+
eq_('/blog', url_for('/blog'))
eq_('/blog#here', url_for('/blog', anchor='here'))
-
+
def test_url_for_with_unicode(self):
con = self.con
con.mapper_dict = {}
-
+
eq_('/blog', url_for(controller='blog'))
eq_('/blog/view/umulat', url_for(controller='blog', action='view', id=u'umulat'))
- eq_('/blog/view/umulat?other=%CE%B1%CF%83%CE%B4%CE%B3',
+ eq_('/blog/view/umulat?other=%CE%B1%CF%83%CE%B4%CE%B3',
url_for(controller='blog', action='view', id=u'umulat', other=u'\u03b1\u03c3\u03b4\u03b3'))
-
+
url = URLGenerator(con.mapper, {})
for urlobj in [url_for, url]:
def raise_url():
return urlobj(u'/some/st\xc3rng')
assert_raises(Exception, raise_url)
-
+
def test_url_for(self):
con = self.con
con.mapper_dict = {}
url = URLGenerator(con.mapper, {'HTTP_HOST':'www.test.com:80'})
-
+
for urlobj in [url_for, url]:
eq_('/blog', urlobj(controller='blog'))
eq_('/content', urlobj())
eq_('https://www.test.com/viewpost', urlobj(controller='post', action='view', protocol='https'))
eq_('http://www.test.org/content', urlobj(host='www.test.org'))
-
+
def test_url_raises(self):
con = self.con
con.mapper.explicit = True
@@ -70,12 +70,12 @@ class TestUtils(unittest.TestCase):
url = URLGenerator(con.mapper, {})
assert_raises(GenerationException, url_for, action='juice')
assert_raises(GenerationException, url, action='juice')
-
+
def test_url_for_with_defaults(self):
con = self.con
con.mapper_dict = {'controller':'blog','action':'view','id':4}
url = URLGenerator(con.mapper, {'wsgiorg.routing_args':((), con.mapper_dict)})
-
+
eq_('/blog/view/4', url_for())
eq_('/post/index/4', url_for(controller='post'))
eq_('/blog/view/2', url_for(id=2))
@@ -85,10 +85,10 @@ class TestUtils(unittest.TestCase):
eq_('/post/index/4', url.current(controller='post'))
eq_('/blog/view/2', url.current(id=2))
eq_('/viewpost/4', url.current(controller='post', action='view', id=4))
-
+
con.mapper_dict = {'controller':'blog','action':'view','year':2004}
url = URLGenerator(con.mapper, {'wsgiorg.routing_args':((), con.mapper_dict)})
-
+
eq_('/archive/2004/10', url_for(month=10))
eq_('/archive/2004/9/2', url_for(month=9, day=2))
eq_('/blog', url_for(controller='blog', year=None))
@@ -96,12 +96,12 @@ class TestUtils(unittest.TestCase):
eq_('/archive/2004/10', url.current(month=10))
eq_('/archive/2004/9/2', url.current(month=9, day=2))
eq_('/blog', url.current(controller='blog', year=None))
-
+
def test_url_for_with_more_defaults(self):
con = self.con
con.mapper_dict = {'controller':'blog','action':'view','id':4}
url = URLGenerator(con.mapper, {'wsgiorg.routing_args':((), con.mapper_dict)})
-
+
eq_('/blog/view/4', url_for())
eq_('/post/index/4', url_for(controller='post'))
eq_('/blog/view/2', url_for(id=2))
@@ -111,7 +111,7 @@ class TestUtils(unittest.TestCase):
eq_('/post/index/4', url.current(controller='post'))
eq_('/blog/view/2', url.current(id=2))
eq_('/viewpost/4', url.current(controller='post', action='view', id=4))
-
+
con.mapper_dict = {'controller':'blog','action':'view','year':2004}
url = URLGenerator(con.mapper, {'wsgiorg.routing_args':((), con.mapper_dict)})
eq_('/archive/2004/10', url_for(month=10))
@@ -123,7 +123,7 @@ class TestUtils(unittest.TestCase):
eq_('/archive/2004/9/2', url.current(month=9, day=2))
eq_('/blog', url.current(controller='blog', year=None))
eq_('/archive/2004', url.current())
-
+
def test_url_for_with_defaults_and_qualified(self):
m = self.con.mapper
m.connect('home', '', controller='blog', action='splash')
@@ -133,7 +133,7 @@ class TestUtils(unittest.TestCase):
self.con.environ = dict(SCRIPT_NAME='', HTTP_HOST='www.example.com', PATH_INFO='/blog/view/4')
self.con.environ.update({'wsgiorg.routing_args':((), self.con.mapper_dict)})
url = URLGenerator(m, self.con.environ)
-
+
eq_('/blog/view/4', url_for())
eq_('/post/index/4', url_for(controller='post'))
eq_('http://www.example.com/blog/view/4', url_for(qualified=True))
@@ -145,26 +145,26 @@ class TestUtils(unittest.TestCase):
eq_('http://www.example.com/blog/view/4', url.current(qualified=True))
eq_('/blog/view/2', url.current(id=2))
eq_('/viewpost/4', url.current(controller='post', action='view', id=4))
-
+
env = dict(SCRIPT_NAME='', SERVER_NAME='www.example.com', SERVER_PORT='8080', PATH_INFO='/blog/view/4')
env['wsgi.url_scheme'] = 'http'
self.con.environ = env
self.con.environ.update({'wsgiorg.routing_args':((), self.con.mapper_dict)})
url = URLGenerator(m, self.con.environ)
-
+
eq_('/post/index/4', url_for(controller='post'))
eq_('http://www.example.com:8080/blog/view/4', url_for(qualified=True))
-
+
eq_('/post/index/4', url.current(controller='post'))
eq_('http://www.example.com:8080/blog/view/4', url.current(qualified=True))
-
+
def test_route_overflow(self):
m = self.con.mapper
m.create_regs(["x"*50000])
m.connect('route-overflow', "x"*50000)
url = URLGenerator(m, {})
eq_("/%s" % ("x"*50000), url('route-overflow'))
-
+
def test_with_route_names(self):
m = self.con.mapper
self.con.mapper_dict = {}
@@ -172,7 +172,7 @@ class TestUtils(unittest.TestCase):
m.connect('category_home', 'category/:section', controller='blog', action='view', section='home')
m.create_regs(['content','blog','admin/comments'])
url = URLGenerator(m, {})
-
+
for urlobj in [url, url_for]:
eq_('/content/view', urlobj(controller='content', action='view'))
eq_('/content', urlobj(controller='content'))
@@ -180,10 +180,10 @@ class TestUtils(unittest.TestCase):
eq_('/category', urlobj('category_home'))
eq_('/category/food', urlobj('category_home', section='food'))
eq_('/', urlobj('home'))
-
+
def test_with_route_names_and_defaults(self):
m = self.con.mapper
- self.con.mapper_dict = {}
+ self.con.mapper_dict = {}
m.connect('home', '', controller='blog', action='splash')
m.connect('category_home', 'category/:section', controller='blog', action='view', section='home')
m.connect('building', 'building/:campus/:building/alljacks', controller='building', action='showjacks')
@@ -196,12 +196,12 @@ class TestUtils(unittest.TestCase):
eq_('/', url_for('home'))
eq_('/building/wilma/port/alljacks', url.current())
eq_('/', url.current('home'))
-
+
def test_with_route_names_and_hardcode(self):
m = self.con.mapper
self.con.mapper_dict = {}
m.hardcode_names = False
-
+
m.connect('home', '', controller='blog', action='splash')
m.connect('category_home', 'category/:section', controller='blog', action='view', section='home')
m.connect('building', 'building/:campus/:building/alljacks', controller='building', action='showjacks')
@@ -220,7 +220,7 @@ class TestUtils(unittest.TestCase):
eq_('/', url.current('home'))
eq_('/gallery/home_thumbnail.jpg', url.current('gallery_thumb', img_id='home'))
eq_('/gallery/home_thumbnail.jpg', url.current('gallery', img_id='home'))
-
+
m.hardcode_names = True
eq_('/gallery/home_thumbnail.jpg', url_for('gallery_thumb', img_id='home'))
eq_('/gallery/home.jpg', url_for('gallery', img_id='home'))
@@ -228,7 +228,7 @@ class TestUtils(unittest.TestCase):
eq_('/gallery/home_thumbnail.jpg', url.current('gallery_thumb', img_id='home'))
eq_('/gallery/home.jpg', url.current('gallery', img_id='home'))
m.hardcode_names = False
-
+
def test_redirect_to(self):
m = self.con.mapper
self.con.mapper_dict = {}
@@ -260,7 +260,7 @@ class TestUtils(unittest.TestCase):
m.connect('home', '', controller='blog', action='splash')
m.connect('category_home', 'category/:section', controller='blog', action='view', section='home')
m.create_regs(['content','blog','admin/comments'])
-
+
redirect_to(controller='content', action='view')
eq_('/content/view', redirect_to.result)
redirect_to(controller='content')
@@ -273,7 +273,7 @@ class TestUtils(unittest.TestCase):
eq_('/category/food', redirect_to.result)
redirect_to('home')
eq_('/', redirect_to.result)
-
+
def test_static_route(self):
m = self.con.mapper
self.con.mapper_dict = {}
@@ -282,14 +282,14 @@ class TestUtils(unittest.TestCase):
m.connect('home', 'http://www.groovie.org/', _static=True)
m.connect('space', '/nasa/images', _static=True)
m.create_regs(['content', 'blog'])
-
+
url = URLGenerator(m, {})
for urlobj in [url_for, url]:
eq_('http://www.groovie.org/', urlobj('home'))
eq_('http://www.groovie.org/?s=stars', urlobj('home', s='stars'))
eq_('/content/view', urlobj(controller='content', action='view'))
eq_('/nasa/images?search=all', urlobj('space', search='all'))
-
+
def test_static_route_with_script(self):
m = self.con.mapper
self.con.mapper_dict = {}
@@ -299,7 +299,7 @@ class TestUtils(unittest.TestCase):
m.connect('space', '/nasa/images', _static=True)
m.connect('login', '/login', action='nowhereville')
m.create_regs(['content', 'blog'])
-
+
self.con.environ.update({'wsgiorg.routing_args':((), {})})
url = URLGenerator(m, self.con.environ)
for urlobj in [url_for, url]:
@@ -309,7 +309,7 @@ class TestUtils(unittest.TestCase):
eq_('/webapp/nasa/images?search=all', urlobj('space', search='all'))
eq_('http://example.com/webapp/nasa/images', urlobj('space', protocol='http'))
eq_('http://example.com/webapp/login', urlobj('login', qualified=True))
-
+
def test_static_route_with_vars(self):
m = self.con.mapper
self.con.mapper_dict = {}
@@ -317,7 +317,7 @@ class TestUtils(unittest.TestCase):
m.connect('home', 'http://{domain}.groovie.org/{location}', _static=True)
m.connect('space', '/nasa/{location}', _static=True)
m.create_regs(['home', 'space'])
-
+
self.con.environ.update({'wsgiorg.routing_args':((), {})})
url = URLGenerator(m, self.con.environ)
for urlobj in [url_for, url]:
@@ -328,7 +328,7 @@ class TestUtils(unittest.TestCase):
eq_('http://fred.groovie.org/index?search=all', urlobj('home', domain='fred', location='index', search='all'))
eq_('/webapp/nasa/images?search=all', urlobj('space', location='images', search='all'))
eq_('http://example.com/webapp/nasa/images', urlobj('space', location='images', protocol='http'))
-
+
def test_static_route_with_vars_and_defaults(self):
m = self.con.mapper
self.con.mapper_dict = {}
@@ -336,10 +336,10 @@ class TestUtils(unittest.TestCase):
m.connect('home', 'http://{domain}.groovie.org/{location}', domain='routes', _static=True)
m.connect('space', '/nasa/{location}', location='images', _static=True)
m.create_regs(['home', 'space'])
-
+
self.con.environ.update({'wsgiorg.routing_args':((), {})})
url = URLGenerator(m, self.con.environ)
-
+
assert_raises(GenerationException, url_for, 'home')
assert_raises(GenerationException, url_for, 'home', domain='fred')
eq_('http://routes.groovie.org/index', url_for('home', location='index'))
@@ -350,7 +350,7 @@ class TestUtils(unittest.TestCase):
eq_('http://example.com/webapp/nasa/articles', url_for('space', location='articles', protocol='http'))
eq_('/webapp/nasa/images?search=all', url_for('space', search='all'))
eq_('http://example.com/webapp/nasa/images', url_for('space', protocol='http'))
-
+
assert_raises(GenerationException, url.current, 'home')
assert_raises(GenerationException, url.current, 'home', domain='fred')
eq_('http://routes.groovie.org/index', url.current('home', location='index'))
@@ -361,8 +361,8 @@ class TestUtils(unittest.TestCase):
eq_('http://example.com/webapp/nasa/articles', url.current('space', location='articles', protocol='http'))
eq_('/webapp/nasa/images?search=all', url.current('space', search='all'))
eq_('http://example.com/webapp/nasa/images', url.current('space', protocol='http'))
-
-
+
+
def test_static_route_with_vars_and_requirements(self):
m = self.con.mapper
self.con.mapper_dict = {}
@@ -370,8 +370,8 @@ class TestUtils(unittest.TestCase):
m.connect('home', 'http://{domain}.groovie.org/{location}', requirements=dict(domain='fred|bob'), _static=True)
m.connect('space', '/nasa/articles/{year}/{month}', requirements=dict(year=r'\d{2,4}', month=r'\d{1,2}'), _static=True)
m.create_regs(['home', 'space'])
-
-
+
+
self.con.environ.update({'wsgiorg.routing_args':((), {})})
url = URLGenerator(m, self.con.environ)
@@ -400,7 +400,7 @@ class TestUtils(unittest.TestCase):
eq_('/webapp/nasa/articles/2004/6', url.current('space', year='2004', month='6'))
eq_('/webapp/nasa/articles/2004/12', url.current('space', year='2004', month='12'))
eq_('/webapp/nasa/articles/89/6', url.current('space', year='89', month='6'))
-
+
def test_no_named_path(self):
m = self.con.mapper
self.con.mapper_dict = {}
@@ -409,14 +409,14 @@ class TestUtils(unittest.TestCase):
m.connect('home', 'http://www.groovie.org/', _static=True)
m.connect('space', '/nasa/images', _static=True)
m.create_regs(['content', 'blog'])
-
+
url = URLGenerator(m, {})
for urlobj in [url_for, url]:
eq_('http://www.google.com/search', urlobj('http://www.google.com/search'))
eq_('http://www.google.com/search?q=routes', urlobj('http://www.google.com/search', q='routes'))
eq_('/delicious.jpg', urlobj('/delicious.jpg'))
eq_('/delicious/search?v=routes', urlobj('/delicious/search', v='routes'))
-
+
def test_append_slash(self):
m = self.con.mapper
self.con.mapper_dict = {}
@@ -426,7 +426,7 @@ class TestUtils(unittest.TestCase):
m.connect('home', 'http://www.groovie.org/', _static=True)
m.connect('space', '/nasa/images', _static=True)
m.create_regs(['content', 'blog'])
-
+
url = URLGenerator(m, {})
for urlobj in [url_for, url]:
eq_('http://www.google.com/search', urlobj('http://www.google.com/search'))
@@ -444,7 +444,7 @@ class TestUtils(unittest.TestCase):
m.connect('home', 'http://www.groovie.org/', _static=True)
m.connect('space', '/nasa/images', _static=True)
m.create_regs(['content', 'blog'])
-
+
url = URLGenerator(m, self.con.environ)
for urlobj in [url_for, url]:
eq_('http://www.google.com/search', urlobj('http://www.google.com/search'))
@@ -464,7 +464,7 @@ class TestUtils(unittest.TestCase):
)
)
return kargs
-
+
self.con.mapper_dict = {}
self.con.environ = dict(SCRIPT_NAME='', HTTP_HOST='example.com')
@@ -475,16 +475,16 @@ class TestUtils(unittest.TestCase):
_filter=article_filter)
m.create_regs(['content','archives','admin/comments'])
self.con.mapper = m
-
+
url = URLGenerator(m, self.con.environ)
for urlobj in [url_for, url]:
assert_raises(Exception, urlobj, controller='content', action='view')
assert_raises(Exception, urlobj, controller='content')
-
+
eq_('/content/view-3.html', urlobj(controller='content', action='view', id=3))
eq_('/content/index-2.html', urlobj(controller='content', id=2))
-
- eq_('/archives/2005/10/5/happy',
+
+ eq_('/archives/2005/10/5/happy',
urlobj('archives',year=2005, month=10, day=5, slug='happy'))
story = dict(year=2003, month=8, day=2, slug='woopee')
empty = {}
@@ -492,9 +492,9 @@ class TestUtils(unittest.TestCase):
'month':'10','day':'5','slug':'happy'}, m.match('/archives/2005/10/5/happy'))
eq_('/archives/2003/8/2/woopee', urlobj('archives', article=story))
eq_('/archives/2004/12/20/default', urlobj('archives', article=empty))
-
+
def test_with_ssl_environ(self):
- base_environ = dict(SCRIPT_NAME='', HTTPS='on', SERVER_PORT='443', PATH_INFO='/',
+ base_environ = dict(SCRIPT_NAME='', HTTPS='on', SERVER_PORT='443', PATH_INFO='/',
HTTP_HOST='example.com', SERVER_NAME='example.com')
self.con.mapper_dict = {}
self.con.environ = base_environ.copy()
@@ -505,16 +505,16 @@ class TestUtils(unittest.TestCase):
m.create_regs(['content','archives','admin/comments'])
m.sub_domains = True
self.con.mapper = m
-
+
url = URLGenerator(m, self.con.environ)
for urlobj in [url_for, url]:
-
+
# HTTPS is on, but we're running on a different port internally
eq_(self.con.protocol, 'https')
eq_('/content/view', urlobj(controller='content', action='view'))
eq_('/content/index/2', urlobj(controller='content', id=2))
eq_('https://nowhere.com/content', urlobj(host='nowhere.com', controller='content'))
-
+
# If HTTPS is on, but the port isn't 443, we'll need to include the port info
environ = base_environ.copy()
environ.update(dict(SERVER_PORT='8080'))
@@ -525,10 +525,10 @@ class TestUtils(unittest.TestCase):
eq_('https://nowhere.com:8080/content', urlobj(host='nowhere.com:8080', controller='content'))
eq_('http://nowhere.com/content', urlobj(host='nowhere.com', protocol='http', controller='content'))
eq_('http://home.com/content', urlobj(host='home.com', protocol='http', controller='content'))
-
-
+
+
def test_with_http_environ(self):
- base_environ = dict(SCRIPT_NAME='', SERVER_PORT='1080', PATH_INFO='/',
+ base_environ = dict(SCRIPT_NAME='', SERVER_PORT='1080', PATH_INFO='/',
HTTP_HOST='example.com', SERVER_NAME='example.com')
base_environ['wsgi.url_scheme'] = 'http'
self.con.environ = base_environ.copy()
@@ -539,15 +539,15 @@ class TestUtils(unittest.TestCase):
m.connect(':controller/:action/:id')
m.create_regs(['content','archives','admin/comments'])
self.con.mapper = m
-
+
url = URLGenerator(m, self.con.environ)
for urlobj in [url_for, url]:
eq_(self.con.protocol, 'http')
eq_('/content/view', urlobj(controller='content', action='view'))
eq_('/content/index/2', urlobj(controller='content', id=2))
eq_('https://example.com/content', urlobj(protocol='https', controller='content'))
-
-
+
+
def test_subdomains(self):
base_environ = dict(SCRIPT_NAME='', PATH_INFO='/', HTTP_HOST='example.com', SERVER_NAME='example.com')
self.con.mapper_dict = {}
@@ -559,7 +559,7 @@ class TestUtils(unittest.TestCase):
m.connect(':controller/:action/:id')
m.create_regs(['content','archives','admin/comments'])
self.con.mapper = m
-
+
url = URLGenerator(m, self.con.environ)
for urlobj in [url_for, url]:
eq_('/content/view', urlobj(controller='content', action='view'))
@@ -583,40 +583,40 @@ class TestUtils(unittest.TestCase):
m.connect(':controller/:action/:id')
m.create_regs(['content','archives','admin/comments'])
self.con.mapper = m
-
+
url = URLGenerator(m, self.con.environ)
eq_('/content/view', url_for(controller='content', action='view'))
eq_('/content/index/2', url_for(controller='content', id=2))
eq_('/content/view', url(controller='content', action='view'))
eq_('/content/index/2', url(controller='content', id=2))
-
+
environ = base_environ.copy()
environ.update(dict(HTTP_HOST='sub.example.com'))
self.con.environ = environ
self.con.mapper_dict = {'sub_domain':'sub'}
self.con.environ.update({'wsgiorg.routing_args':((), self.con.mapper_dict)})
url = URLGenerator(m, self.con.environ)
-
+
eq_('/content/view/3', url_for(controller='content', action='view', id=3))
eq_('http://new.example.com/content', url_for(controller='content', sub_domain='new'))
eq_('http://example.com/content', url_for(controller='content', sub_domain='www'))
eq_('/content/view/3', url(controller='content', action='view', id=3))
eq_('http://new.example.com/content', url(controller='content', sub_domain='new'))
eq_('http://example.com/content', url(controller='content', sub_domain='www'))
-
+
self.con.mapper_dict = {'sub_domain':'www'}
self.con.environ.update({'wsgiorg.routing_args':((), self.con.mapper_dict)})
url = URLGenerator(m, self.con.environ)
-
+
eq_('http://example.com/content/view/3', url_for(controller='content', action='view', id=3))
eq_('http://new.example.com/content', url_for(controller='content', sub_domain='new'))
eq_('/content', url_for(controller='content', sub_domain='sub'))
-
+
# This requires the sub-domain, because we don't automatically go to the existing match dict
eq_('http://example.com/content/view/3', url(controller='content', action='view', id=3, sub_domain='www'))
eq_('http://new.example.com/content', url(controller='content', sub_domain='new'))
eq_('/content', url(controller='content', sub_domain='sub'))
-
+
def test_subdomains_with_named_routes(self):
base_environ = dict(SCRIPT_NAME='', PATH_INFO='/', HTTP_HOST='example.com', SERVER_NAME='example.com')
self.con.mapper_dict = {}
@@ -630,32 +630,32 @@ class TestUtils(unittest.TestCase):
m.connect('building', 'building/:campus/:building/alljacks', controller='building', action='showjacks')
m.create_regs(['content','blog','admin/comments','building'])
self.con.mapper = m
-
+
url = URLGenerator(m, self.con.environ)
for urlobj in [url_for, url]:
eq_('/content/view', urlobj(controller='content', action='view'))
eq_('/content/index/2', urlobj(controller='content', id=2))
eq_('/category', urlobj('category_home'))
eq_('http://new.example.com/category', urlobj('category_home', sub_domain='new'))
-
+
environ = base_environ.copy()
environ.update(dict(HTTP_HOST='sub.example.com'))
self.con.environ = environ
self.con.mapper_dict = {'sub_domain':'sub'}
self.con.environ.update({'wsgiorg.routing_args':((), self.con.mapper_dict)})
url = URLGenerator(m, self.con.environ)
-
+
eq_('/content/view/3', url_for(controller='content', action='view', id=3))
- eq_('http://joy.example.com/building/west/merlot/alljacks',
+ eq_('http://joy.example.com/building/west/merlot/alljacks',
url_for('building', campus='west', building='merlot', sub_domain='joy'))
eq_('http://example.com/category/feeds', url_for('category_home', section='feeds', sub_domain=None))
eq_('/content/view/3', url(controller='content', action='view', id=3))
- eq_('http://joy.example.com/building/west/merlot/alljacks',
+ eq_('http://joy.example.com/building/west/merlot/alljacks',
url('building', campus='west', building='merlot', sub_domain='joy'))
eq_('http://example.com/category/feeds', url('category_home', section='feeds', sub_domain=None))
-
+
def test_subdomains_with_ports(self):
base_environ = dict(SCRIPT_NAME='', PATH_INFO='/', HTTP_HOST='example.com:8000', SERVER_NAME='example.com')
self.con.mapper_dict = {}
@@ -669,20 +669,20 @@ class TestUtils(unittest.TestCase):
m.connect('building', 'building/:campus/:building/alljacks', controller='building', action='showjacks')
m.create_regs(['content','blog','admin/comments','building'])
self.con.mapper = m
-
+
url = URLGenerator(m, self.con.environ)
for urlobj in [url, url_for]:
self.con.environ['HTTP_HOST'] = 'example.com:8000'
eq_('/content/view', urlobj(controller='content', action='view'))
eq_('/category', urlobj('category_home'))
eq_('http://new.example.com:8000/category', urlobj('category_home', sub_domain='new'))
- eq_('http://joy.example.com:8000/building/west/merlot/alljacks',
+ eq_('http://joy.example.com:8000/building/west/merlot/alljacks',
urlobj('building', campus='west', building='merlot', sub_domain='joy'))
-
+
self.con.environ['HTTP_HOST'] = 'example.com'
del self.con.environ['routes.cached_hostinfo']
eq_('http://new.example.com/category', urlobj('category_home', sub_domain='new'))
-
+
def test_subdomains_with_default(self):
base_environ = dict(SCRIPT_NAME='', PATH_INFO='/', HTTP_HOST='example.com:8000', SERVER_NAME='example.com')
self.con.mapper_dict = {}
@@ -697,37 +697,37 @@ class TestUtils(unittest.TestCase):
m.connect('building', 'building/:campus/:building/alljacks', controller='building', action='showjacks')
m.create_regs(['content','blog','admin/comments','building'])
self.con.mapper = m
-
+
urlobj = URLGenerator(m, self.con.environ)
self.con.environ['HTTP_HOST'] = 'example.com:8000'
eq_('/content/view', urlobj(controller='content', action='view'))
eq_('http://cat.example.com:8000/category', urlobj('category_home'))
-
+
self.con.environ['HTTP_HOST'] = 'example.com'
del self.con.environ['routes.cached_hostinfo']
-
+
assert_raises(GenerationException, lambda: urlobj('category_home', sub_domain='new'))
-
+
def test_controller_scan(self):
here_dir = os.path.dirname(__file__)
- controller_dir = os.path.join(os.path.dirname(here_dir),
+ controller_dir = os.path.join(os.path.dirname(here_dir),
os.path.join('test_files', 'controller_files'))
controllers = controller_scan(controller_dir)
eq_(len(controllers), 3)
eq_(controllers[0], 'admin/users')
eq_(controllers[1], 'content')
eq_(controllers[2], 'users')
-
+
def test_auto_controller_scan(self):
here_dir = os.path.dirname(__file__)
- controller_dir = os.path.join(os.path.dirname(here_dir),
+ controller_dir = os.path.join(os.path.dirname(here_dir),
os.path.join('test_files', 'controller_files'))
m = Mapper(directory=controller_dir, explicit=False)
m.minimization = True
m.always_scan = True
m.connect(':controller/:action/:id')
-
+
eq_({'action':'index', 'controller':'content','id':None}, m.match('/content'))
eq_({'action':'index', 'controller':'users','id':None}, m.match('/users'))
eq_({'action':'index', 'controller':'admin/users','id':None}, m.match('/admin/users'))
@@ -745,44 +745,44 @@ class TestUtilsWithExplicit(unittest.TestCase):
con.host = 'www.test.com'
con.protocol = 'http'
self.con = con
-
+
def test_url_for(self):
con = self.con
con.mapper_dict = {}
-
+
assert_raises(Exception, url_for, controller='blog')
assert_raises(Exception, url_for)
eq_('/blog/view/3', url_for(controller='blog', action='view', id=3))
eq_('https://www.test.com/viewpost', url_for(controller='post', action='view', protocol='https'))
eq_('http://www.test.org/content/view/2', url_for(host='www.test.org', controller='content', action='view', id=2))
-
+
def test_url_for_with_defaults(self):
con = self.con
con.mapper_dict = {'controller':'blog','action':'view','id':4}
-
+
assert_raises(Exception, url_for)
assert_raises(Exception, url_for, controller='post')
assert_raises(Exception, url_for, id=2)
eq_('/viewpost/4', url_for(controller='post', action='view', id=4))
-
+
con.mapper_dict = {'controller':'blog','action':'view','year':2004}
assert_raises(Exception, url_for, month=10)
assert_raises(Exception, url_for, month=9, day=2)
assert_raises(Exception, url_for, controller='blog', year=None)
-
+
def test_url_for_with_more_defaults(self):
con = self.con
con.mapper_dict = {'controller':'blog','action':'view','id':4}
-
+
assert_raises(Exception, url_for)
assert_raises(Exception, url_for, controller='post')
assert_raises(Exception, url_for, id=2)
eq_('/viewpost/4', url_for(controller='post', action='view', id=4))
-
+
con.mapper_dict = {'controller':'blog','action':'view','year':2004}
assert_raises(Exception, url_for, month=10)
assert_raises(Exception, url_for)
-
+
def test_url_for_with_defaults_and_qualified(self):
m = self.con.mapper
m.connect('home', '', controller='blog', action='splash')
@@ -791,23 +791,23 @@ class TestUtilsWithExplicit(unittest.TestCase):
m.create_regs(['content','blog','admin/comments'])
env = dict(SCRIPT_NAME='', SERVER_NAME='www.example.com', SERVER_PORT='80', PATH_INFO='/blog/view/4')
env['wsgi.url_scheme'] = 'http'
-
+
self.con.environ = env
-
+
assert_raises(Exception, url_for)
assert_raises(Exception, url_for, controller='post')
assert_raises(Exception, url_for, id=2)
assert_raises(Exception, url_for, qualified=True, controller='blog', id=4)
eq_('http://www.example.com/blog/view/4', url_for(qualified=True, controller='blog', action='view', id=4))
eq_('/viewpost/4', url_for(controller='post', action='view', id=4))
-
+
env = dict(SCRIPT_NAME='', SERVER_NAME='www.example.com', SERVER_PORT='8080', PATH_INFO='/blog/view/4')
env['wsgi.url_scheme'] = 'http'
self.con.environ = env
assert_raises(Exception, url_for, controller='post')
eq_('http://www.example.com:8080/blog/view/4', url_for(qualified=True, controller='blog', action='view', id=4))
-
-
+
+
def test_with_route_names(self):
m = self.con.mapper
m.minimization = True
@@ -869,7 +869,7 @@ class TestUtilsWithExplicit(unittest.TestCase):
eq_('/messages/4/edit', url_for('edit_message', id=4))
eq_('/messages/4/mark', url_for('mark_message', id=4))
eq_('/messages/new', url_for('new_message'))
-
+
eq_('/messages.xml', url_for('formatted_messages', format='xml'))
eq_('/messages/rss.xml', url_for('formatted_rss_messages', format='xml'))
eq_('/messages/4.xml', url_for('formatted_message', id=4, format='xml'))
@@ -894,14 +894,14 @@ class TestUtilsWithExplicit(unittest.TestCase):
eq_('/messages/4/edit', url_for('edit_message', id=4))
eq_('/messages/4/mark', url_for('mark_message', id=4))
eq_('/messages/new', url_for('new_message'))
-
+
eq_('/messages.xml', url_for('formatted_messages', format='xml'))
eq_('/messages/rss.xml', url_for('formatted_rss_messages', format='xml'))
eq_('/messages/4.xml', url_for('formatted_message', id=4, format='xml'))
eq_('/messages/4/edit.xml', url_for('formatted_edit_message', id=4, format='xml'))
eq_('/messages/4/mark.xml', url_for('formatted_mark_message', id=4, format='xml'))
eq_('/messages/new.xml', url_for('formatted_new_message', format='xml'))
-
+
if __name__ == '__main__':
unittest.main()
@@ -910,11 +910,11 @@ else:
m = Mapper(explicit=False)
m.connect('', controller='articles', action='index')
m.connect('admin', controller='admin/general', action='index')
-
+
m.connect('admin/comments/article/:article_id/:action/:id', controller = 'admin/comments', action = None, id=None)
m.connect('admin/trackback/article/:article_id/:action/:id', controller='admin/trackback', action=None, id=None)
m.connect('admin/content/:action/:id', controller='admin/content')
-
+
m.connect('xml/:action/feed.xml', controller='xml')
m.connect('xml/articlerss/:id/feed.xml', controller='xml', action='articlerss')
m.connect('index.rdf', controller='xml', action='rss')
@@ -931,7 +931,7 @@ else:
con.host = 'www.test.com'
con.protocol = 'http'
con.mapper_dict = {'controller':'xml','action':'articlerss'}
-
+
if withcache:
m.urlcache = {}
m._create_gens()