Hi all,
I have been using 0.9.6 until recently and after upgrade I noticed a
change in
behaviour: I use formencode and the @validate decorator with a form
parameter.
Now, in 0.9.6 the form action called in case of an error received the
same
request.params as the action being validated. It no longer seems to be
happening
in 0.9.7 or 0.10.
I guess I must have misunderstood something and will be grateful for
any advice.
Thanks in advance,
--
Petr
========================================
CODE:
When I call validate/index?par1=xxx
fill a non-number into the second text-field and press submit, I get
an exception
on the second line of index.
controllers/validate.py:
=================
import logging
import formencode
from pylons.decorators import validate
from petrsstuff.lib.base import *
class V1(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
par2 = formencode.validators.Int()
class ValidateController(BaseController):
def index(self):
c.par1 = request.params["par1"]
return render("/valindex.mako")
@validate(schema=V1(),form="index")
def save(self):
return "%s" % request.params
templates/valindex.mako:
===================
<html><head></head><body>
${ h.form(h.url_for(controller="validate", action="save"),
method="post") }
TEXT: ${ h.text("par1", c.par1) }<br>
NUMBER: ${ h.text("par2", "") }<br>
${ h.submit("submit", "submit") }
${ h.end_form() }
</body></html>
--
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.