[web, urlrewrite] remove unused `cachekey` argument from `rgx_action` (closes #5355967)
authorKatia Saurfelt <katia.saurfelt@logilab.fr>
Thu, 30 Apr 2015 13:06:45 +0200
changeset 10399 5234525560ac
parent 10398 bd00b58b00d9
child 10400 383a5e629145
[web, urlrewrite] remove unused `cachekey` argument from `rgx_action` (closes #5355967) this argument prevent from generating the resulting rset descripition
web/test/unittest_urlrewrite.py
web/views/urlrewrite.py
--- a/web/test/unittest_urlrewrite.py	Fri Jun 19 17:54:04 2015 +0200
+++ b/web/test/unittest_urlrewrite.py	Thu Apr 30 13:06:45 2015 +0200
@@ -145,6 +145,7 @@
             _pmid, rset = rewriter.rewrite(req, u'/DaLToN/JoE')
             self.assertEqual(len(rset), 1)
             self.assertEqual(rset[0][0], self.p1eid)
+            self.assertEqual(rset.description[0][0], 'CWUser')
 
     def test_inheritance_precedence(self):
         RQL1 = 'Any C WHERE C is CWEType'
--- a/web/views/urlrewrite.py	Fri Jun 19 17:54:04 2015 +0200
+++ b/web/views/urlrewrite.py	Thu Apr 30 13:06:45 2015 +0200
@@ -167,16 +167,13 @@
         return None, None
     return do_build_rset
 
-def rgx_action(rql=None, args=None, cachekey=None, argsgroups=(), setuser=False,
+def rgx_action(rql=None, args=None, argsgroups=(), setuser=False,
                form=None, formgroups=(), transforms={}, rqlformparams=(), controller=None):
     def do_build_rset(inputurl, uri, req, schema,
-                      cachekey=cachekey # necessary to avoid UnboundLocalError
                       ):
         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)
@@ -184,13 +181,11 @@
                         kwargs[key] = transforms[key](value)
                     except KeyError:
                         kwargs[key] = value
-                    if cachekey is not None and key in cachekey:
-                        kwargs[key] = int(value)
             if setuser:
                 kwargs['u'] = req.user.eid
             for param in rqlformparams:
                 kwargs.setdefault(param, req.form.get(param))
-            rset = req.execute(rql, kwargs, cachekey)
+            rset = req.execute(rql, kwargs)
         else:
             rset = None
         form2 = form and form.copy() or {}