[Zope] Error Value: Can't pickle objects in acquisition wrappers
jose carlos
jcsenciales at citic.es
Mon May 22 11:24:34 EDT 2006
Hi,
I have a product with a container class to save a list of groups and
others objects..
The container class is:
class StorageAdapter(ObjectManager, BasicUserFolder):
....
....
this class have a function to add groups like that:
def addGroup(self, id="", nombre="", REQUEST =None):
"""to add a new group"""
#create a group
grupo = Group(id, nombre)
#add a group to container
try:
self._objects=self._objects+
({'id':id,'meta_type':Group.meta_type},)
self._setOb(id,grupo)
object=self._getOb(id)
self._p_changed = 1
except: return MessageDialog(
title ='error',
message='error al añadir grupo',
)
if REQUEST is not None:
REQUEST['RESPONSE'].redirect(self.absolute_url()+'/gestGroupForm')
The class group is simple like this.
class Group(ObjectManager, BasicUserFolder):
"""Class Group"""
meta_type = 'Group'
title ='Grupo'
def __init__(self, id, nombre):
_debug("init del Group")
self.id=id
self.nombre=nombre
#acl to control this group
f=AclUserFolder()
_debug("creo el acl del Group")
try: self._setObject('acl_users', f)
except: return MessageDialog(
title ='error Acl Existente',
message='Este Group ya contiene un ACL',
)
self.__allow_groups__=self.acl_users
...
...
...
the function addGroup is called from a dtml and the groups are added ok
and later I can view the result perfectly in dtml, but i want to add a
new attribute to class group then in the method __init__ i have add the
sentence:
self.contacts=[]
this is the only change and then i obtain this error:
2006-05-22T16:29:14 ERROR Zope.SiteErrorLog
http://localhost:8080/prueba/ST/addGroup
Traceback (most recent call last):
File "/usr/lib/zope/lib/python/ZPublisher/Publish.py", line 119, in
publish
transactions_manager.commit()
File "/usr/lib/zope/lib/python/Zope2/App/startup.py", line 234, in
commit
transaction.commit()
File "/usr/lib/zope/lib/python/transaction/_manager.py", line 84, in
commit
self.get().commit(sub)
File "/usr/lib/zope/lib/python/transaction/_transaction.py", line 381,
in commit
self._saveCommitishError() # This raises!
File "/usr/lib/zope/lib/python/transaction/_transaction.py", line 379,
in commit
self._commitResources()
File "/usr/lib/zope/lib/python/transaction/_transaction.py", line 424,
in _commitResources
rm.commit(self)
File "/usr/lib/zope/lib/python/ZODB/Connection.py", line 462, in
commit
self._commit(transaction)
File "/usr/lib/zope/lib/python/ZODB/Connection.py", line 503, in
_commit
self._store_objects(ObjectWriter(obj), transaction)
File "/usr/lib/zope/lib/python/ZODB/Connection.py", line 525, in
_store_objects
p = writer.serialize(obj) # This calls __getstate__ of obj
File "/usr/lib/zope/lib/python/ZODB/serialize.py", line 330, in
serialize
return self._dump(meta, obj.__getstate__())
TypeError: Can't pickle objects in acquisition wrappers.
i don't known where can be my error, if someone can help me.
thank
jose carlos
More information about the Zope
mailing list