Kevin Dangoor wrote:
On 1/4/06, JP Farias <[EMAIL PROTECTED]> wrote:
Is there a way to pass parameters to the callback?
I just wanted to pass the **kw the controller method receives to the
callback
to create the form.
No, the callback can't take parameters. However, cherrypy.request
should have everything you need.
Kevin
--
Kevin Dangoor
Author of the Zesty News RSS newsreader
email: [EMAIL PROTECTED]
company: http://www.BlazingThings.com
blog: http://www.BlueSkyOnMars.com
As a side note, it looks like if you pass in a callable to the
decorator, the callable gets passed in your controller object. This is
from controllers.py:
104 def validate(form=None, validators=None):
105 def decorator(func):
106 def newfunc(self, *args, **kw):
107 processed = getattr(cherrypy.request,
"form_processed", False)
108 if not processed and form:
109 if callable(form) and not
hasattr(form,'declarative_count'):
110 inputform = form(self)
111 else:
112 inputform = form
So, I guess if you needed something that didn't come in on
cherrypy.request, you could hang it off of your controller before the
form is created. I think it's probably safer to try to get it passed in
on cherrypy.request, though.
- jmj