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

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


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