[lxml-dev] Explicit type checking and zope.security

Christian Zagrodnick cz at gocept.com
Mon Feb 18 14:37:43 CET 2008


On 2008-02-18 14:15:27 +0100, Stefan Behnel <stefan_ml at behnel.de> said:

> Hi,
> 
> Christian Zagrodnick wrote:
>> lxml does quite some explicit type checking. For instance:
>> 
>> object_path.addattr(root, value)
>> 
>> gives me an error if root is security proxied:
>> 
>> File "objectpath.pxi", line 74, in lxml.objectify.ObjectPath.addattr
>> TypeError: Argument 'root' has incorrect type (expected
>> lxml.etree._Element, got zope.security._proxy._Proxy)
>> 
>> Is this explicit checking really necessary? It's quite annoying to have
>> to unwrap everything (and eventually check manually for security)
>> before putting it into lxml's hands.
> 
> You would get a crash if lxml didn't check the type. _Element objects are
> proxies that contain a pointer to the C struct of a libxml2 node, so passing a
> wrapper won't work.

Sounds reasonable :)

I'm not too familiar with C extensions. So never mind.

-- 
Christian Zagrodnick

gocept gmbh & co. kg  ·  forsterstrasse 29 · 06112 halle/saale
www.gocept.com · fon. +49 345 12298894 · fax. +49 345 12298891





More information about the lxml-dev mailing list