John Schinnerer wrote at 2004-9-13 15:33 -0700:
I am trying to use the below code (from zopelabs) to update my existing class instances. When I run the python script to invoke the external method, I get an Attribute error on REQUEST.
Be warned that the automatic "self" passing to ExternalMethods does not work reliably when the External Methods has optional arguments (as in your case). Pass the "self" explicitely.
... #create a file in $ZOPE/Extensions called schema.py def addPropertyToObjectType(self, meta_type, property, prop_type=None): """ does a find for all meta_type's and then attaches this proeprty to them if they dont already ahve it """ root=None if self.REQUEST.has_key('VirtualRootPhysicalPath'): ... context.addPropertyToMetaType('DTML Document', 'my_CustomProperty')
Use "context.addProperty...(context, ...) -- Dieter