[Zope] Re: Access error trying to use pyRXP example wrapper from an external method

Jean Lagarde jlagarde@bigfoot.com
Mon, 09 Dec 2002 20:42:02 -0800


Well, allright, I did have a peek in the xmlutils code, and I guess the 
issue is that the TagWrapper class redefines such things as __len__ and 
__getitem__ to do its thing. I'm guessing that's what Zope's security 
mechanism doesn't like, but I have no clue how to fix it, so hints would 
still be appreciated!

BTW, I have tested pyRXP and xmlutils in the Python shell, and they work 
fine from there.

-- Jean

Jean Lagarde wrote:

> Hi all,
>
> I'm a bit rusty on Zope and Python (was never that good to start 
> with...), and I was hoping to be able to do something quick this 
> evening but I've hit a brick wall. I have the following very simple 
> external method:
>
> def niceXML(XMLstring):
>
>  import pyRXP
>  import xmlutils
>
>  tree = pyRXP.Parser().parse(XMLstring)
>
>  return xmlutils.TagWrapper(tree)
>
> pyRXP is the parser provided by the ReportLab folks. I had used their 
> example xmlutils wrapper before in straight Python and rather liked 
> it, so I wanted to use it from Zope using the external method above. 
> However, although I can call the external method and get the wrapper 
> object from Zope, everytime I try to use the object within Zope (e.g. 
> object[0], object.TagName, etc.), Zope returns the error "Not allowed 
> to access <0, or TagName, or etc.> in this context". I assume it has 
> something to do with how the xmlutils wrapper works, but I haven't 
> dared look at the code yet.
>
> Anybody has any pointer as to what might be wrong here to make my 
> troubleshooting job a bit easier (and faster!)?
>
> Thanks ahead,
>
> Jean
>
>