[Twisted-web] Flatten problem in livepage trunk

Thomas HERVE therve at free.fr
Tue Sep 27 11:37:12 MDT 2005

Quoting Tommi Virtanen <tv at twistedmatrix.com>:
> If you can reproduce that without livepage, I can fix it.
> I can't help with livepage, though.

Unfortunately (well... or not), it's not a i18n problem, it's really a 
problem. Livepage didn't handle i18n on 0.4.1 either, but a workaroud was
possible (and  not too complicated).

> _('test1') returns an
> object that when flattened becomes the string "I'm test 1".
> That should be reproducible without with i18n:
> class Dummy(object):
>    pass
> def flatter(o):
>    return "Hi! I've got a quote!"
> flat.registerFlattener('flatter', 'Dummy')
> def handle_action(self, ctx):
>    client = livepage.IClientHandle(ctx)
>    client.set("mynode", [tags.span[Dummy()]])

Yes it reproduces the problem. I think you've got the point. Livepage can
simple-quote objects when _js called, but it didn't escape it when it's more
complex (typically, i18n or own flatten).


More information about the Twisted-web mailing list