Looks like it might be an issue with twc.MatchValidator.

Try to check the tw2.core versions you have in your development environment
and on production, they probably differ.
There has been a recent change in tw2 that fixed i18n in validators, that
changed how validators that work on other fields work (like MatchValidator)
and maybe that is related.


On Sat, Apr 26, 2014 at 11:23 PM, Antonio Fregoso <
[email protected]> wrote:

> Hi All
>
>
> In development server the validation work excellent but in production
> send me this error:
>
>
> ---------------------------------------------------------------------------------------------------------------------------------------
>   File "/usr/local/lib/python2.7/dist-packages/tg/wsgiapp.py", line 105,
> in __call__
>
>     response = self.wrapped_dispatch(controller, environ, context)
>
>     File "/usr/local/lib/python2.7/dist-packages/tg/wsgiapp.py", line 278,
> in dispatch
>
>     return controller(environ, context)
>
>     File "/var/www/conference/conference/lib/base.py", line 26, in __call__
>
>     return TGController.__call__(self, environ, context)
>
>     File
> "/usr/local/lib/python2.7/dist-packages/tg/controllers/dispatcher.py", line
> 123, in __call__
>
>     response = self._perform_call(context)
>
>     File
> "/usr/local/lib/python2.7/dist-packages/tg/controllers/dispatcher.py", line
> 104, in _perform_call
>
>     r = self._call(func, params, remainder=remainder, context=context)
>
>     File
> "/usr/local/lib/python2.7/dist-packages/tg/controllers/decoratedcontroller.py",
> line 104, in _call
>
>     params = self._perform_validate(controller, validate_params)
>
>     File
> "/usr/local/lib/python2.7/dist-packages/tg/controllers/decoratedcontroller.py",
> line 223, in _perform_validate
>
>     new_params = validation.validators.validate(params, formencode_state)
>
>     File
> "/usr/local/lib/python2.7/dist-packages/tw2.core-2.2.1.1-py2.7.egg/tw2/core/widgets.py",
> line 523, in validate
>
>     return ins._validate(value, state)
>
>     File
> "/usr/local/lib/python2.7/dist-packages/tw2.core-2.2.1.1-py2.7.egg/tw2/core/validation.py",
> line 106, in wrapper
>
>     d = fn(self, *args, **kw)
>
>     File
> "/usr/local/lib/python2.7/dist-packages/tw2.core-2.2.1.1-py2.7.egg/tw2/core/widgets.py",
> line 990, in _validate
>
>     return self.child._validate(value, state)
>
>     File
> "/usr/local/lib/python2.7/dist-packages/tw2.core-2.2.1.1-py2.7.egg/tw2/core/validation.py",
> line 106, in wrapper
>
>     d = fn(self, *args, **kw)
>
>     File
> "/usr/local/lib/python2.7/dist-packages/tw2.core-2.2.1.1-py2.7.egg/tw2/core/widgets.py",
> line 681, in _validate
>
>     val = c._validate(d, state)
>
>     File
> "/usr/local/lib/python2.7/dist-packages/tw2.core-2.2.1.1-py2.7.egg/tw2/core/validation.py",
> line 106, in wrapper
>
>     d = fn(self, *args, **kw)
>
>     File
> "/usr/local/lib/python2.7/dist-packages/tw2.core-2.2.1.1-py2.7.egg/tw2/core/widgets.py",
> line 536, in _validate
>
>     value = self.validator.to_python(value, state)
>
>     File
> "/usr/local/lib/python2.7/dist-packages/tw2.core-2.2.1.1-py2.7.egg/tw2/core/validation.py",
> line 231, in to_python
>
>     self._validate_python(value, state)
>
>     File
> "/usr/local/lib/python2.7/dist-packages/tw2.core-2.2.1.1-py2.7.egg/tw2/core/validation.py",
> line 619, in _validate_python
>
>     if self.other_field not in state or value != state[self.other_field]:
>
>     TypeError: argument of type 'type' is not iterable
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> This is my form:
>
> class LeadForm(twf.Form):
>     class child(twf.ListLayout):
>         hover_help = True
>         name=twf.TextField(label=u'Nombre:', css_class='FormField',
> validator=twc.Required)
>         partner=twf.TextField(label=u'Empresa:', css_class='FormField',
> validator=twc.Required)
>         phone=twf.TextField(label=u'Teléfono:', css_class='FormField',
> validator=twc.Required)
>         email=twf.TextField(label=u'Correo:', css_class='FormField',
> validator=twc.EmailValidator)
>         email2=twf.TextField(label=u'Confirmar Correo:',
> css_class='FormField', validator=twc.MatchValidator('email'))
>         channel=twf.HiddenField()
>         campaign=twf.HiddenField()
>     action=lurl('/lpthanks')
>     buttons=[twf.SubmitButton('send',value = u'Solicite mas Información',
> css_class='FormButton')]
>
> This is my controler:
>
>     @expose('conference.templates.contact')
>     def contact(self,channel='Organic',tp=1, *args,**kw):
>         keys={'channel':channel}
>         keys['sector']=tp
>         InfoForm.action= lurl('/thanks')
>         return dict(form=InfoForm, keys=keys)
>
>     @expose('conference.templates.thanks')
>     @validate(InfoForm, error_handler=contact)
>     def thanks(self, *args, **kw):
>         """Handle list of landing page."""
>
>           return dict(data=kw)
>
>
> The strange thing is that it works perfectly on the development server,
> not on production. :-(
>
> Thanks for your help
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/turbogears.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to