Re: [FE-discuss] formencode invalid exception

Top Page
Author: Ian Bicking
Date:  
To: Anil
CC: pylons-discuss, Allan Saddi, formencode-discuss
Subject: Re: [FE-discuss] formencode invalid exception
Anil wrote:
> I have:
> def reset(self):
> """ Reset password for email given in POST arguments """
> from formencode import validators
>
> mail_validator = validators.Email(not_empty=True)
> try:
> mail = request.params.get("mail")
> mail_validator.to_python(mail)
> except validators.Invalid, e:
> return e
>
> Which is called through a AJAX h.submit_to_remote call, which updates
> a DIV element with the "e".
>
>
> Actually, I sent an email to Allan before, and he sent:
>
> The application/framework is responsible for all encoding/decoding,
> according to the WSGI spec:
>
> http://www.python.org/dev/peps/pep-0333/#unicode-issues
>
> The WSGI interface only supports plain strings.


Ah... I thought the exception was from the flup error handler trying to
format the exception somehow.

Probably whatever calls reset() should do return
unicode(self.reset()).encode('utf8')

-- 
Ian Bicking : ianb@??? : http://blog.ianbicking.org

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
FormEncode-discuss mailing list
FormEncode-discuss@???
https://lists.sourceforge.net/lists/listinfo/formencode-discuss