
On Jun 20, 2006, at 10:36 PM, Stefan Behnel wrote:
Hi Petr,
Petr van Blokland wrote:
Using XPath Python functions, right now I instantiate a global object that functions can work on. That works fine, however for multi- threading applications in the future that won't work. What do you thinks is the best approach: locking the lxml process while running an XSLT transformation or searching/finding (or waiting for) a way to pass Python variables through to XPath functions?
I'm not quite sure what you're trying to do, but if it's about stateful functions, I'd implement them as callable objects. You can always use normal Python locking to serialise access to the object state.
Stefan
Stefan, something like the following:
rq = None
... global rq rq = httprequest # e.g. coming from Twisted Matrix xsltree.transform(xmltree) ...
Where an external XPath function might be implemented as:
externalfunction(dummy, value): from xxxx import rq rq.value = value
The question is about: is this the way to do it, or is there/will there be a way to pass the rq through XSLT.
Petr
---------------------------------------------- Petr van Blokland buro@petr.com | www.petr.com | +31 15 219 10 40 ----------------------------------------------