I upgraded a site in development to TurboGears 2.0.1 which appears to
have disabled validation on my site.
The following code works with the following versions:
python 2.5
TurboGears2-1.9.7a2
tw.forms 0.9.1
FormEncode 1.0.1
ToscaWidgets 0.9.2
simplejson 1.9.1
---model
from tw.core import WidgetsList
from tw.forms import TableForm, TextField, TextArea, RadioButtonList,
CheckBox, HiddenField, SingleSelectField, PasswordField
from tw.forms.validators import NotEmpty, Regex
class TestForm(TableForm):
action = 'testadd'
submit_text = 'Add test'
class fields(WidgetsList):
User = TextField(label_text='Username', size=40,
validator=NotEmpty())
---controller
@expose('controlpanel.templates.template')
def form(self, **kw):
pylons.c.form = TestForm()
return dict(template='form',title='Test Form',value=None)
@validate(TestForm(), error_handler=form)
def testadd(self, **kw):
flash('great success')
redirect('form')
---template
<div xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip="">
${tmpl_context.form(value=value)}
</div>
However, if using that virtual environment upgrade tw.forms,
validation stops working. Is this a bug or is there a new method for
doing validation? I see no changes on the toscawidgets site as their
last news item was in 2008. The updates on formencode's site mention
some minor changes and a quick test of formencode from the virtual
environment appears to act as expected. I see nothing on the tw.forms
page that seems to indicate a change in anything that would affect
validation between the version that works and the one that is
installed.
$ easy_install -U tw.forms
Searching for tw.forms
Reading http://pypi.python.org/simple/tw.forms/
Reading http://toscawidgets.org
Reading http://toscawidgets.org/download
Reading http://twtools.googlecode.com/svn/dist
Best match: tw.forms 0.9.7
Downloading
http://pypi.python.org/packages/source/t/tw.forms/tw.forms-0.9.7.tar.gz#md5=3e193223891c3c32e4137a39b08b11be
Processing tw.forms-0.9.7.tar.gz
Running tw.forms-0.9.7/setup.py -q bdist_egg --dist-dir /tmp/
easy_install-prv_2S/tw.forms-0.9.7/egg-dist-tmp-V7k9rX
Removing tw.forms 0.9.1 from easy-install.pth file
Adding tw.forms 0.9.7 to easy-install.pth file
Installed /var/www/tg2env/lib/python2.5/site-packages/tw.forms-0.9.7-
py2.5.egg
Processing dependencies for tw.forms
Searching for FormEncode>=1.1
Reading http://pypi.python.org/simple/FormEncode/
Reading http://formencode.org
Reading http://formencode.sf.net
Best match: FormEncode 1.2.2
Downloading
http://pypi.python.org/packages/source/F/FormEncode/FormEncode-1.2.2.tar.gz#md5=da23d54af521d1feab12b4caf30e3111
Processing FormEncode-1.2.2.tar.gz
Running FormEncode-1.2.2/setup.py -q bdist_egg --dist-dir /tmp/
easy_install-JvVTtn/FormEncode-1.2.2/egg-dist-tmp-EFBGzS
warning: no files found matching '*.py' under directory '.'
warning: no files found matching '*.html' under directory 'docs'
no previously-included directories found matching '**/.svn'
Removing FormEncode 1.0.1 from easy-install.pth file
Adding FormEncode 1.2.2 to easy-install.pth file
Installed /var/www/tg2env/lib/python2.5/site-packages/FormEncode-1.2.2-
py2.5.egg
Searching for ToscaWidgets>=0.9.7
Reading http://pypi.python.org/simple/ToscaWidgets/
Reading http://toscawidgets.org/
Reading http://toscawidgets.org/download/
Best match: ToscaWidgets 0.9.7.1
Downloading
http://pypi.python.org/packages/source/T/ToscaWidgets/ToscaWidgets-0.9.7.1.tar.gz#md5=3994904d8b0091ccce357eb61ab1caec
Processing ToscaWidgets-0.9.7.1.tar.gz
Running ToscaWidgets-0.9.7.1/setup.py -q bdist_egg --dist-dir /tmp/
easy_install-qfs7ot/ToscaWidgets-0.9.7.1/egg-dist-tmp-ALT0tf
Removing ToscaWidgets 0.9.2 from easy-install.pth file
Adding ToscaWidgets 0.9.7.1 to easy-install.pth file
Installed /var/www/tg2env/lib/python2.5/site-packages/
ToscaWidgets-0.9.7.1-py2.5.egg
Searching for simplejson>=2.0
Reading http://pypi.python.org/simple/simplejson/
Reading http://undefined.org/python/#simplejson
Best match: simplejson 2.0.9
Downloading
http://pypi.python.org/packages/source/s/simplejson/simplejson-2.0.9.tar.gz#md5=af5e67a39ca3408563411d357e6d5e47
Processing simplejson-2.0.9.tar.gz
Running simplejson-2.0.9/setup.py -q bdist_egg --dist-dir /tmp/
easy_install-qn_jtL/simplejson-2.0.9/egg-dist-tmp-qmXXol
Removing simplejson 1.9.1 from easy-install.pth file
Adding simplejson 2.0.9 to easy-install.pth file
Installed /var/www/tg2env/lib/python2.5/site-packages/simplejson-2.0.9-
py2.5-linux-i686.egg
Finished processing dependencies for tw.forms
Using the same code in a freshly installed 2.0.1 from pypi results in
the validation not working as well. Since it doesn't work in 2.0.1, I
am guessing that the methods were changed. Can someone point me to
the documentation regarding the new method for validation?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---