[Twisted-web] Livepage, ClientHandle and context

Thomas HERVE therve at free.fr
Mon May 30 15:17:08 MDT 2005

I've just started to use nevow i18n and I'm pretty happy with it, it works very
well and the automatic detection of browser language is invisible.

But my app uses livepage a lot, and I began to face problems when trying to
translate strings in "dynamic renderers". After some investigations, I found my
problem : i18n uses the i18nconfig saved in context to translate strings,  but
livepage.ClientHandle makes a new "fake" context for each calls via the
livepage.flt function.

I resolved my problem by creating my ClientHandle and ClientHandleFactory
implementations, the ClientHandle saving the context at its creation (pretty
easy, but I would have found it cleaner if clientHandleFactory was a class
variable of LivePage, Input and Output, and not a module global). Thus, the
i18nconfig remains in context.

My question is : is this choice good, or is there a good reason for ClientHandle
not to keep track of the context ? If not, wouldn't it be better to save context
in ClientHandle (it would useful for others things, getting session for example)


More information about the Twisted-web mailing list