shaped up routing: enabled explicit mode, and created some named routes
[zzz-floof.git] / floof / config / routing.py
index 969376a..6ec64e4 100644 (file)
@@ -10,8 +10,13 @@ from routes import Mapper
 def make_map():
     """Create, configure and return the routes Mapper"""
     map = Mapper(directory=config['pylons.paths']['controllers'],
-                 always_scan=config['debug'])
+                 always_scan=config['debug'], explicit=True)
     map.minimization = False
+    # explicit = True disables a broken feature called "route memory",
+    # where it adds everything matched in the current request as default variables
+    # for the next one.  This is wrong because it doesn't invalidate things lower down in
+    # the hierarchy when higher up things change.  Rails port failure.
+    # NOTE: this also disables actions defaulting to index, sorry.
 
     require_POST = dict(conditions={'method': ['POST']})
 
@@ -36,12 +41,12 @@ def make_map():
     # Art stuff
     map.connect('/art/new', controller='art', action='new')
     map.connect('/art/upload', controller='art', action='upload')
-    map.connect('/art/{id}', controller='art', action='show')
+    map.connect('show_art', '/art/{id}', controller='art', action='show')
     map.connect('/art/{id}/tag', controller='art', action='tag')
 
     map.connect('/tag/{id}/delete', controller='tag', action='delete')
 
-    map.connect('/search', controller='search', action='index')
+    map.connect('search', '/search', controller='search', action='index')
     map.connect('/search/list', controller='search', action='list')