davelists2@peoplemerge.com wrote:
Hi all,
====Aclass.py==== class Aclass(ZSI.TCcompound.Struct): def __init__: self._attr = "Attribute" def getAttr(): return self.attr
====myTool.py==== from Aclass import Aclass from Globals import InitializeClass from OFS.SimpleItem import SimpleItem from AccessControl import ClassSecurityInfo from Products.CMFCore.utils import getToolByName, UniqueObject from Products.CMFCore import CMFCorePermissions
class myTool(SimpleTool,UniqueObject): meta_type="myTool" id="myTool" def getAclass(self): inter = [base.Aclass(),] return inter
Now I want to myTool.getAclass().getAttr() What's by importing myTool from unrestricted python, there's no problem.
When I access the tool from a (restricted) script or ZPT, it gives me: Insufficient Privileges or AccessControl.unauthorized.Unauthorized: You are not allowed to access 'getAttr' in this context.
I gather (thanks kosh@freenode#zope) that I need to wrap the objects in inter in an acquisition wrapper. But I can't inherit from SimpleItem as well as ZSI.TCcompound.Struct:
File "/usr/lib/python2.3/site-packages/ZSI/TCcompound.py", line 65, in __init__ raise TypeError('pyclass must be None or a class, not <extension class ExtensionClass at f6b..>
Any Suggestions?
Thanks... And sorry for my bad python. This pseudocode should be an accurate representation of what I get from ZSI's wsdl2py from Amazon's Web Services 3.0 WSDL. Complex stuff, so try to not suggest something that would require I change Aclass -- been down that road already. _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Aclass needs to be inherited from Acquisition.Explcitit or Implicit and and in myTool: def getAclass(self): inter = [base.Aclass().__of__(self),] return inter hope this helps maybe you need to add security declarations to your class