Is your new class completely custom, or did you derive it from an existing class (e.g., DTML Document)? Something that has worked for me in the past is to do a search on the set of objects... for obj in context.objectValues('MyClassMetaName'): .. and then use the base class addProperty method to add the additional property. You can also put a try/except block in your code to handle exceptions. Hope that helps. Ron
Hello,
I'm trying to add a new attribute to all objects of a certain meta_type on my site. These are objects that already exist and are already instantiated.
But, no matter how I go about it, I always end up with the same end result:
Error Type: TypeError Error Value: attribute-less object (assign or del)
I've treid using portal_catalog search results, and then something like : setattr(a,'newporperty',''), but that gives me the error above. I also tried o.property = '', but that didn't help ...
I also tried creating myobject = o.getObject() ... no go ...
Then I found some examples on various web sites that use ZopeFind to locate their objects ... tried that, still no luck.
What am I missing here? One thing, this is a custom object I added to the CMFDefault product, could that be part of the problem? This object otherwise works great within Zope and the CMF.
The traceback output varies depending on how I try to go about it, but here is the lastest one:
File Script (Python), line 14, in addPropertyToObjectType (Object: english) File /usr/local/Zope-2.5.0/lib/python/RestrictedPython/Guards.py, line 107, in guarded_setattr (Object: density) File /usr/local/Zope-2.5.0/lib/python/RestrictedPython/Guards.py, line 72, in handler
"English" is a Portal Folder, "density" is one of my custom objects ....
Help ?
Thanks in advance,
J.F.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )