[lxml-dev] LXML and persistence with the ZODB?

Stefan Behnel stefan_ml at behnel.de
Fri Jun 27 20:32:29 CEST 2008


Hi,

Martijn Faassen wrote:
> That said, it'd still be tricky. It'd be nice to get a modification 
> notification from lxml for instance, so that the ZODB knows that a tree 
> has been changed and thus needs to be marked dirty so that a new 
> transaction can be committed.

If someone provides code for such a feature, I will consider adding it.
However, it must have a negligible performance impact (especially if not used)
and meaningful event types.

Problems: the public C-API enables access to the tree at the C level, and
adding an Element to a different tree removes it from the source tree, so
changes can be non-local for a tree.


> There are other tricky issues; if you use custom classes for your 
> elements, you can't get away with just pickling the XML anymore, as 
> you'd lose this information.

I wonder if it isn't enough to put a warning into the docs that pickling does
not store all tree state and that unpickling will only work correctly inside
the same parser setup that was used for pickling. I would expect that most
applications can easily achieve this.

We'd only have to find a way to associate a concrete parser setup with an
unpickler.

Stefan


More information about the lxml-dev mailing list