Re: formencode invalid exception

Ian Bicking <[email protected]>
Newsgroups gmane.comp.python.formencode,gmane.comp.web.pylons.general
Message-ID <[email protected]>
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 : [email protected] : 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.