cubicweb #1060507 Proposal for support for form content in rgx_action [resolved]

It is often useful to use request form content in a rql query directly in urlrewriting. Adding a rqlformparams optional argument in rgx_action does the trick :

def rgx_action(rql=None, args=None, cachekey=None, argsgroups=(), setuser=False,
               form=None, formgroups=(), transforms={}, rqlformparams=(), controller=None):
    '''same has cw rgx_action but adds a rqlformparams to allow adding form params in rql expr'''
    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 =
                        kwargs[key] = transforms[key](value)
                    except KeyError:
                        kwargs[key] = value
                    if cachekey is not None and key in cachekey:
                        kwargs[key] = typed_eid(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 = None
        form2 = form and form.copy() or {}
        if formgroups:
            match = inputurl.match(uri)
            for key in formgroups:
                form2[key] =
        if "vtitle" in form2:
            form2['vtitle'] = req.__(form2['vtitle'])
        if form2:
        return controller, rset
    return do_build_rset
done in3.9.9
load left0.000
closed by<not specified>