equal
deleted
inserted
replaced
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """Rules based url rewriter component, to get configurable RESTful urls""" |
18 """Rules based url rewriter component, to get configurable RESTful urls""" |
19 |
19 |
20 import re |
20 import re |
21 |
21 |
22 from cubicweb import typed_eid |
|
23 from cubicweb.uilib import domid |
22 from cubicweb.uilib import domid |
24 from cubicweb.appobject import AppObject |
23 from cubicweb.appobject import AppObject |
25 |
24 |
26 |
25 |
27 def rgx(pattern, flags=0): |
26 def rgx(pattern, flags=0): |
184 try: |
183 try: |
185 kwargs[key] = transforms[key](value) |
184 kwargs[key] = transforms[key](value) |
186 except KeyError: |
185 except KeyError: |
187 kwargs[key] = value |
186 kwargs[key] = value |
188 if cachekey is not None and key in cachekey: |
187 if cachekey is not None and key in cachekey: |
189 kwargs[key] = typed_eid(value) |
188 kwargs[key] = int(value) |
190 if setuser: |
189 if setuser: |
191 kwargs['u'] = req.user.eid |
190 kwargs['u'] = req.user.eid |
192 for param in rqlformparams: |
191 for param in rqlformparams: |
193 kwargs.setdefault(param, req.form.get(param)) |
192 kwargs.setdefault(param, req.form.get(param)) |
194 rset = req.execute(rql, kwargs, cachekey) |
193 rset = req.execute(rql, kwargs, cachekey) |