On Sep 28, 7:39 pm, Graham Higgins <[email protected]> wrote:
> I dunno if this helps but there seem to be three required libraries
> missing from that list. Check Pylons' setup.py for the list of
> install_requires and you'll see it includes:
>
> "Routes>=1.10.3", "WebHelpers>=0.6.4", "Beaker>=1.3dev",
> "Paste>=1.7.2", "PasteDeploy>=1.3.3", "PasteScript>=1.7.3",
> "FormEncode>=1.2.1", "simplejson>=2.0.8", "decorator>=2.3.2",
> "nose>=0.10.4", "Mako>=0.2.4", "WebOb>=0.9.6.1", "WebError>=0.10.1",
> "WebTest>=1.1", "Tempita>=0.2",
>
> So it looks like WebOb-0.9.6.1, simplejson-2.0.8 and FormEncode-1.2.1
> would appear to be missing.
>
> The install_requires for tw.forms' setup.py also specifies
> FormEncode>=1.1.
I missed these on the test virtualenv, they are present on the
original virtualenv, but, even with those added, I get the same
results.
I am using python2.5 rather than 2.6. Validation does work with
formbuild on both the test and the original virtualenv I had set up.
out of curiosity, can you add this controller and template to a
virtualenv and see if the code itself is right?
templates/test_test.mako:
${tmpl_context.form()|n}
controllers/test.py:
from pylons import request, response, session, tmpl_context
from pylons.controllers.util import abort, redirect_to
from twt.lib.base import BaseController, render
import tw.forms as twf
from tw.mods.pylonshf import validate
movie_form = twf.TableForm('index', action='save', children=[
twf.HiddenField('id'),
twf.TextField('title'),
twf.TextField('year', size=4),
twf.CalendarDatePicker('release_date'),
twf.SingleSelectField('genera', options=['', 'Action', 'Comedy',
'Other']),
#twf.TextArea('description'),
twf.TextArea('description', validator=twf.validators.NotEmpty),
])
class TestController(BaseController):
def index(self):
tmpl_context.form = movie_form
return render('/test_test.mako')
@validate(form=movie_form, error_handler=index)
def save(self, **kw):
return str(kw)
The thing that is confusing is, even my other forms with the chained
schemas are properly flagging the fields as required. If I do a post
and validation doesn't turn up any errors in the submitted data, the
controller works. When there is an error, in this case, I just hit
the submit button, I get the error. Since description is the only
required field, if it does include some data, it will successfully
pass validation.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---