[Twisted-web] Flatten problem in livepage trunk

Tommi Virtanen tv at twistedmatrix.com
Tue Sep 27 02:36:43 MDT 2005


Thomas HERVE wrote:
> [...] But I have another problem :
> quotes in
> i18n strings are not escaped. For example if I have :
> 
> def handle_action(self, ctx):
>   client = livepage.IClientHandle(ctx)
>   client.set("mynode", [tags.span[_("test1")]])
> 
> and a locale file :
> 
> msgid "test1"
> msgstr "I'm test 1"

If you can reproduce that without livepage, I can fix it.
I can't help with livepage, though. _('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()]])



More information about the Twisted-web mailing list