I think this is what you are looking for. Two values are pulled from the field_dict.
http://bitbucket.org/gjhiggins/shabti/src/tip/shabti/templates/authplus/+package+/forms/validators/validlogin.py_tmpl You might need to put this validator in chained_validators. On Thu, Feb 4, 2010 at 3:09 PM, gazza <[email protected]> wrote: > Hello, > > I guess what I am trying to say is how do you pass multiple values > from a form at the same time to a FancyValidator class? > > Essentially I would like to pass two values that entered in the form > and both are required for validation. > > Any help on this would be appreciated. I see good example on single > fields, just dont see how the multiple fields are dealt with. > > Much appreciated, > Garyc > > On Feb 4, 12:22 pm, gazza <[email protected]> wrote: >> Hello, >> >> I am having a problem understanding how I can pass multiple values at >> once to the fancy validator i.e month and day >> >> class fooFancyValidator(formencode.FancyValidator): >> messages = { >> 'invaliddate' : _("Please select a valid date") >> } >> >> def _to_python(self,value,state): >> if (not value): >> raise Invalid(self.message('invaliddate', state), >> value, state) >> print "enter _to_python %s" value >> >> class ValidateDate(formencode.schema): >> allow_extra_fields = True >> filter_extra_fields = True >> >> month = fooFancyValidator() >> >> I need multiple values to be validated at the same time? i.e month >> +day=fooFancyValidator,maybe a chained_validator? Not sure. >> >> Thanks, >> Garyc >> >> On Feb 4, 10:05 am, Graham Higgins <[email protected]> wrote: >> >> >> >> > -----BEGIN PGP SIGNED MESSAGE----- >> > Hash: SHA1 >> >> > On 4 Feb 2010, at 15:41, gazza wrote: >> >> > > I am trying to find a simple example to create a bespoke validator. >> > > Could you somebody be so kind and point me to an article to accomplish >> > > this in pylons? >> >> > Not an article but a few examples, FWTW (some shamelessly stolen from >> > Ben Bangert's code for Kai, the Pylons app that runs PylonsHQ): >> >> >http://bitbucket.org/gjhiggins/shabti/src/tip/shabti/templates/authpl... >> >> > Cheers, >> >> > Graham >> >> >http://www.linkedin.com/in/ghiggins >> >> > -----BEGIN PGP SIGNATURE----- >> >> > iEYEARECAAYFAktq8EsACgkQOsmLt1NhivyGBACeKuycOBuKBdYR9PIne5JXW7mO >> > WykAnAn8sJJK+YUs/x1dorRCwS9WhmkbiQCVAgUBS2rwS1nrWVZ7aXD1AQIWzAQA >> > sa2/CzpUSwSNypR2ipXf8+iP34Kl7dwHF1CfCPoZRdqNcESo8mtN7KPCuZiYkkyN >> > lY3WM+CZQ3pWtuPX/wl8w86M0rOgheXxxvRI6D88IUzpj8B6BvB9Jdt1JrCK9GyX >> > /KhHmqAxzFkFQo73WGP54KZ6GtdaFFD82yHcYuYqiAs= >> > =Lyu3 >> > -----END PGP SIGNATURE------ Hide quoted text - >> >> - Show quoted text - > > -- > 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. > > -- 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.
