[lxml-dev] [objectify] DataElement factory problem

Stefan Behnel behnel_ml at gkec.informatik.tu-darmstadt.de
Thu Oct 12 19:10:31 CEST 2006


Hi Holger,

Holger Joukl wrote:
> I ran into a problem using the objectify DataElement factory function.
> When implementing an _init method in a derived ObjectifiedDataElement
> class, it is impossible to access the element.text in _init because
> this has not yet been set when _init gets called by _elementFactory.

True, that's a problem.


> Don't see a nice clean way to solve that. Maybe instrument
> _elementFactory with an optional skip_init argument that allows for a
> delayed manual call of _init in corner cases?

Not a good idea, as it is rarely used.

I already thought about adding a public C-API function for creating elements a
while ago, that takes all necessary parameters including the text content. I
think that's the cleanest solution.

Stefan




More information about the lxml-dev mailing list