[Zope] Problems adding attribute to custom object

Jean-Francois.Doyon@CCRS.NRCan.gc.ca Jean-Francois.Doyon@CCRS.NRCan.gc.ca
Thu, 2 May 2002 10:56:48 -0400


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.