fix rgx_action to ensure eids given to .execute are correctly typed stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 16 Nov 2009 10:52:45 +0100
branchstable
changeset 3856 1c9589e46b16
parent 3855 dbd37c10f865
child 3857 6676a839dc97
fix rgx_action to ensure eids given to .execute are correctly typed
web/views/urlrewrite.py
--- a/web/views/urlrewrite.py	Mon Nov 16 10:32:06 2009 +0100
+++ b/web/views/urlrewrite.py	Mon Nov 16 10:52:45 2009 +0100
@@ -7,6 +7,7 @@
 """
 import re
 
+from cubicweb import typed_eid
 from cubicweb.appobject import AppObject
 
 
@@ -152,6 +153,8 @@
         if rql:
             kwargs = args and args.copy() or {}
             if argsgroups:
+                if cachekey is not None and isinstance(cachekey, basestring):
+                    cachekey = (cachekey,)
                 match = inputurl.match(uri)
                 for key in argsgroups:
                     value = match.group(key)
@@ -159,6 +162,8 @@
                         kwargs[key] = transforms[key](value)
                     except KeyError:
                         kwargs[key] = value
+                    if key in cachekey:
+                        kwargs[key] = typed_eid(value)
             if setuser:
                 kwargs['u'] = req.user.eid
             rset = req.execute(rql, kwargs, cachekey)