[Grok-dev] using **kw in a View's Update?

Michael Haubenwallner michael at d2m.at
Tue Feb 3 06:08:07 EST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jeroen Michiel wrote:
> I'm trying to make a view that can handle any request data fed to it by
> declaring the update function as:
>     def update(self, **kw):
>         self.params = kw
> 
> However, it seems params is always empty???

Data is already in request.form, your example should work like this:

class ShowRequestData(grok.View):
    def update(self):
        self.params = self.request.form
    def render(self):
        return str(self.params)

Regards
Michael

- --
http://blog.d2m.at
http://planetzope.org

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJiCWXl0uAvQJUKVYRAhq1AJ4johFNPZT2QqhCrO5lhX1IsblYmwCfTyZC
QDQdZdX1V4oz7hJpFrVdoto=
=pv5F
-----END PGP SIGNATURE-----


More information about the Grok-dev mailing list