On 10/30/07, SamDonaldson <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I ran into another problem on production, where, if I add the
> use_unicode parameter on the mysql:// URI, I get back unicode but I
> see that I get a crash in a particular case with the following stack:
>
> Module pylons.helpers:65 in redirect_to
> <<      and cookies extracted from it and added into the redirect
> issued.    and cookies extracted from it and added into the redirect
> issued."""
>         response = kargs.pop('_response', None)
>         found = httpexceptions.HTTPFound(url_for(*args, **kargs))
>         if response:
>             if str(response.status_code).startswith('3'):>>  found =
> httpexceptions.HTTPFound(url_for(*args, **kargs))
> Module routes.util:200 in url_for
> <<
>         if not isinstance(url, str) and url is not None:
>             raise Exception("url_for can only return a string or None,
> got "
>                             " unicode instead: %s" % url)>>  raise
> Exception("url_for can only return a string or None, got "
> Exception: url_for can only return a string or None, got unicode
> instead:
>
> There's an explicity check on 'str' to see if it's an instance even
> thought it's a unicode object.  How do I get this to work with
> Unicode? Note, I don't get this problem on my dev environment.  On
> production I'm running SCGI + Lighthttpd.

That's really strange, both this and your other error.  Of course, any
time str and unicode are used together in an expression, the str gets
promoted to unicode. So one place to start would be to look back ward
thorough the code and look at the intermediate variables: where was a
unicode value first introduced? In your routes definitions? Do they
show up in the route map result? What does url_for return in "paster
shell"?

scgi is of course a different environment than pastehttpserver.
Perhaps pastehttpserver is more forgiving about converting unicode to
str while scgi just raises an exception.  'use_unicode' is
disrecommended now; the engine option 'convert_unicode' is recommended
instead.

-- 
Mike Orr <[EMAIL PROTECTED]>

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