[Zope-dev] Strange Cut/Paste or Copy/Paste or Import/Export behavior
Dragos Chirila
objectvalues at gmail.com
Wed Jun 1 09:22:59 EDT 2011
Hi all,
I have to containers old_container and new_container that accept objects of
the same type. The two containers are actually instances of different
classes in the same product.
I want to move all the objects from old_container to new_container. I have
tried with only one object:
1. To move it with a simple Cut/Paste operation through ZMI: the object is
moved successfully, but has missing properties
2. I have used Import/Export to move the same object: the object is imported
successfully, but also has missing properties
3. Even tried a simple Copy/Paste: same result, no errors but missing
properties
Basically, the code for the object to be moved is like this:
class Country(Discussion, Folder):
_properties = (
Discussion._properties
+
(
{'id': 'body', 'type': 'text', 'mode': 'w'},
)
)
def __init__(self, id, title, body, comments, flg_notify):
self.id = id
self.title = title
self.body = body
Discussion.__dict__['__init__'](self, comments, flg_notify)
def check_properties(self):
""" """
print hasattr(self, 'body')
print hasattr(self, 'comments')
and
class Discussion:
_properties = (
(
{'id': 'comments', 'type': 'int', 'mode': 'w'},
{'id': 'flg_notify', 'type': 'int', 'mode': 'w'},
)
)
def __init__(self, comments, flg_notify):
self.comments = comments
self.flg_notify = flg_notify
If i run the method check_properties before move/copy/import it prints
True+True. After step 1/2/3 the result is True+False. So the missing
property is 'comments', that comes from the extended class Discussion. If a
I trie to acces the Propeties tab, manage_propertiesForm method, I get:
Traceback (innermost last):
Module ZPublisher.Publish, line 119, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 42, in call_object
Module Shared.DC.Scripts.Bindings, line 313, in __call__
Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
Module App.special_dtml, line 178, in _exec
Module DocumentTemplate.DT_In, line 703, in renderwob
Module DocumentTemplate.DT_Let, line 76, in render
Module DocumentTemplate.DT_Util, line 196, in eval
- __traceback_info__: id
Module <string>, line 0, in ?
Module OFS.PropertyManager, line 151, in getProperty
AttributeError: comments
Am I doing something wrong? Any idea is highly appreciated.
Thank you very much,
Dragos
--
Dragos Chirila
objectValues at gmail.com
(+4) 0722 395375
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope-dev/attachments/20110601/e3620869/attachment.html
More information about the Zope-Dev
mailing list