lxml + mod_python: cannot unmarshal code objects in restricted execution mode

Stefan Behnel stefan.behnel-n05pAM at web.de
Thu Sep 13 11:36:51 EDT 2007


Dmitri Fedoruk wrote:
> def extApplyXslt(xslt, data, logger ):
>     try:
>         strXslt = urllib2.urlopen(xslt).read()
>         # i have to read the xslt url to the python string
>     except urllib2.HTTPError, e:
>        .......
>     except urllib2.URLError, e:
>        .............
>     try:
>         xslt_parser = etree.XMLParser()
>         xslt_parser.resolvers.add( PrefixResolver("XSLT") )
> 
>         # and now I have to use the string; a more elegant solution,
> anyone?

Sure, lxml.etree can parse from file-like objects. Just hand in the result of
urlopen().

Apart from that, I saw that you found your way to the lxml mailing list, I'll
respond over there.

Stefan



More information about the Python-list mailing list