incubator-bloodhound-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olemis Lang <ole...@gmail.com>
Subject Re: Genshi XHTML + HTML 5
Date Sat, 01 Dec 2012 17:13:13 GMT
On 12/1/12, Matevz Bradac <matevzb@gmail.com> wrote:
> Thanks for the suggestion, but unfortunately it won't work on the
> instance level. =/

:'(

> The Stream class is using __slots__, so most instance attributes are
> read-only, e.g. this:
>     import types
>     stream.render = types.MethodType(new_render, stream)
> doesn't work - AttributeError exception.
>

I see .

> Brane suggested monkeypatching on a class/module level, so maybe
> genshi.core.Stream.serialize(),
> or even genshi.output.get_serializer() would be good candidates.
>

that's risky . I'd really suggest to try to solve this at stream level
since monkey patching at module level may be a serious matter .

FWIW ... most of the time I advocate for wrapping rather than monkey
patching , because it's easier to deal with the impact and scope of
the changes .

-- 
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:

Mime
View raw message