Yeah, that's generally considered bad form.  I'm attaching a hg patch
to make the template change.

(Cc'ing pylons-devel).

On Tue, Jul 7, 2009 at 6:55 AM, afrotypa<ovuaia...@gmail.com> wrote:
>
> This is probably not a biggie but in the make_map function (in
> routing.py), the following line reassigns the variable map to a new
> Mapper object for defining routes :-
>
> map = Mapper(directory=config['pylons.paths']['controllers'],
>                 always_scan=config['debug'])
>
> This hides the built-in python map function which is unlikely to be
> used in make_map anyhow. But it will perhaps be safer/clearer to use
> another name (such as route_map) for this mapper object to avoid any
> confusion.

-- 
Kyle.
www.kylev.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

# HG changeset patch
# User Kyle VanderBeek <ky...@kylev.com>
# Date 1246993332 25200
# Branch 0.9.7.x
# Node ID 3a55551e82e6e5d44da3efe7197247cda184ac11
# Parent  87b5793aa41e07542baa62f4d723bd7d50022d2e
Avoid potential namespace confusion with the built-in python map function
by renaming the variable to route_map.

diff -r 87b5793aa41e -r 3a55551e82e6 pylons/templates/minimal_project/+package+/routing.py_tmpl
--- a/pylons/templates/minimal_project/+package+/routing.py_tmpl	Mon Jun 29 17:13:04 2009 -0700
+++ b/pylons/templates/minimal_project/+package+/routing.py_tmpl	Tue Jul 07 12:02:12 2009 -0700
@@ -9,12 +9,12 @@
 
 def make_map():
     """Create, configure and return the routes Mapper"""
-    map = Mapper(directory=config['pylons.paths']['controllers'],
-                 always_scan=config['debug'])
-    map.minimization = False
+    route_map = Mapper(directory=config['pylons.paths']['controllers'],
+                       always_scan=config['debug'])
+    route_map.minimization = False
 
     # CUSTOM ROUTES HERE
 
-    map.connect('/{controller}/{action}')
-    map.connect('/{controller}/{action}/{id}')
-    return map
+    route_map.connect('/{controller}/{action}')
+    route_map.connect('/{controller}/{action}/{id}')
+    return route_map

Reply via email to