You might be able to do it without the pre_validator like:

class EnterInfoValidator(Schema):
   first_name = String(not_empty=True)
   last_name = String(not_empty=True)
    cc_type = String(not_empty=True)
   cc_number = Int(not_empty=True)
   cc_validator = CreditCardValidator('cc_type', 'cc_number')

Did you try that? Did it work? I think that's how I've done it in the past.

-r.

On Tue, Jul 8, 2008 at 3:01 PM, Wyatt Baldwin <[EMAIL PROTECTED]>
wrote:

>
> On Jul 8, 2:17 pm, "Rick Flosi" <[EMAIL PROTECTED]> wrote:
> > Have you looked at the source code? I think there might be an example or
> at
> > least more info in the doc string.
> >
> > I think you might need to define cc_type and cc_number in your validator
> > schema as well.
>
> I came up with the following, which seems to work. Does anyone know if
> this is the "preferred" way to do this? Is there a better way?
>
> cc_validator = CreditCardValidator('cc_type', 'cc_number')
>
> class EnterInfoValidator(Schema):
>    pre_validators = [cc_validator]
>     first_name = String(not_empty=True)
>    last_name = String(not_empty=True)
>     cc_type = String(not_empty=True)
>    cc_number = Int(not_empty=True)
>
> -wlb
>
> >
>


-- 
http://twitter.com/rpf
http://rickflosi.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to