Hi, Removing the safari specific test/code from controllers.py fixes the problems for me when using Safari 2 and 3 (beta). This Safari specific test must be for some old version of Safari, and I don't think it's needed anymore. It breaks more things than it fixes.
-- Dag On Jun 12, 10:06 pm, velotron <[EMAIL PROTECTED]> wrote: > I've been having some troubles with Safari 3.0 and JSON output > on TurboGears 1.0.2.2. I'm using loadJSONDoc to call a controller > which returns JSON. It works fine in other browsers, but > in Safari causes a 500 error with the same exception as > reported in another > threadhttp://groups.google.com/group/turbogears/browse_thread/thread/47ff5d... > > /usr/lib/python2.4/site-packages/TurboGears-1.0.2.2-py2.4.egg/ > turbogears/controllers.py", line 100, in _process_output > output = unicodechars.sub( > TypeError: expected string or buffer > > The same call worked fine on TG 1.0. The call also works fine if I > set > the User-Agent in the Safari browser to something other than > safari. > > In _process_output of TG 1.0, the type of output is checked before > attempting > unicode.sub(): > if ua.browser == "safari" and not > isinstance(output,types.GeneratorType): > > but in TG 1.0.2.2 it's not checked: > if ua.browser == "safari": > > I pushed the isinstance check into controllers.py of my 1.0.2.2 > installation, > and the call succeeded. I don't know enough about the motivation > of that change to recommend this fix though. > > I wonder if maybe another level of indentation was intended on line > 100? > > if isinstance(output, str): > output = output.decode(enc) > output = unicodechars.sub( > lambda m: "&#x%x;" % ord(m.group(1)), output).encode("ascii") > > Thanks, > Joseph --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

