actually fix rgx_action stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 16 Nov 2009 18:10:51 +0100
branchstable
changeset 3865 f9778a00e47f
parent 3864 2fee9151c6b2
child 3866 2783c166ad1a
actually fix rgx_action
web/views/urlrewrite.py
--- a/web/views/urlrewrite.py	Mon Nov 16 17:51:45 2009 +0100
+++ b/web/views/urlrewrite.py	Mon Nov 16 18:10:51 2009 +0100
@@ -149,10 +149,11 @@
 
 def rgx_action(rql=None, args=None, cachekey=None, argsgroups=(), setuser=False,
                form=None, formgroups=(), transforms={}, controller=None):
-    def do_build_rset(inputurl, uri, req, schema):
+    def do_build_rset(inputurl, uri, req, schema,
+                      cachekey=cachekey # necessary to avoid UnboundLocalError
+                      ):
         if rql:
             kwargs = args and args.copy() or {}
-            cachekey = cachekey # necessary to avoid UnboundLocalError
             if argsgroups:
                 if cachekey is not None and isinstance(cachekey, basestring):
                     cachekey = (cachekey,)
@@ -163,7 +164,7 @@
                         kwargs[key] = transforms[key](value)
                     except KeyError:
                         kwargs[key] = value
-                    if key in cachekey:
+                    if cachekey is not None and key in cachekey:
                         kwargs[key] = typed_eid(value)
             if setuser:
                 kwargs['u'] = req.user.eid