Christopher Arndt wrote:

>jose schrieb:
>  
>
>>This documentation is very, very useful, thank you very much for having 
>>wrote it.
>>    
>>
>
>Thanks, though I can only take credit for the second doc, I only revised the
>first one.
>
>  
>
>>first question:
>>
>> email = validators.Email(not_empty=True, max=255, strip=True)
>>I expect that validator strips the field before validate it. I tried a 
>>definition like this one
>>and I insert some spaces into the field. I supposed validator considered 
>>it as an empty field, but...
>>    
>>
>
>... but? Did it not?
>
>  
>
yes.

>>second question:
>>
>>class EmailMatchesName(validators.FancyValidator):
>>    def _to_python(self, value, state):
>>        name = value.get('name', '').replace(' ', '.')
>>        email_prefix = value.get('email', '').split('@', 1)[0]
>>        if email_prefix != name:
>>            raise validators.Invalid(
>>                'Email does not conform to naming rules.',
>>                value, state)
>>        return value
>>
>>I tried this validator but it raise the error message at the right side 
>>of every field in my form.
>>How to display it only near one filed?
>>    
>>
>
>To be honest, I don't know. I've noticed this effect too, which comes from the
>fact that the validator is used as a chained valiadator and as such, validates
>the whole form and apparently sets the error message for each field. I have no
>idea, how to work around this. Anybody else, maybe?
>  
>
thank you anyway, I solved it thanks to Alberto Valverde.

jo

>Chris
>
>>
>  
>


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

Reply via email to