On Mon, Apr 05, 2010 at 12:46:22AM -0700, 彪 蒋 wrote:
> NotImplementedError: Action 'form' is not implemented
> I get this error message.who can help me!
>
> my controller like this
> ...
> from pylons.decorators import validate
...
> class EmailForm(formencode.Schema):
> ...
>
> class SignupController(BaseController):
> def index(self):
> ...
> @validate(schema=EmailForm(), form='form')
> def register(self):
> ...
If you browse the documentation for validate:
>>> from pylons.decorators import validate
>>> help(validate)
>> Help on function validate in module pylons.decorators:
>>
>> validate(schema=None, validators=None, form=None, variable_decode=False,
>> dict_char='.', list_char='-', post_only=True, state=None, on_get=False,
>> **htmlfill_kwargs)
>>...
>>...
it tells you that the value of form should be:
>> ``form``
>> Method used to display the form, which will be used to get the
>> HTML representation of the form for error filling.
Then it provides an example:
>>
>> Example::
>>
>> class SomeController(BaseController):
>>
>> def create(self, id):
>> return render('/myform.mako')
>>
>> @validate(schema=model.forms.myshema(), form='create')
>> def update(self, id):
>> # Do something with self.form_result
>> pass
your 'register' controller handles data that does validate.
the missing 'form' controller handles data that doesn't validate
(probably sends it back to the template).
You have to provide such a controller, and name it in the @validate call
--
Anita
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.