Hello zope-dev! http://www.zope.org/Collectors/Zope/1911 I try to migrate my old database from zope 2.6.1. I have Broken objects, but it is impossible to get its state in Zope 2.8. In Zope 2.6 Broken objects have states, what i uses to migrate its. I think this is because DB.classFactory is overrided to use OFS.Uninstalled.BrokenClass, which is bad persistent class. the __dict__ of all my Broken objects equals to {'_p_changed':None}. my_object._p_mtime does not load it`s state. -- Best regards, Victor Safronovich NauMen.NauDoc.SoftwareDeveloper http://www.naumen.ru
Victor Safronovich wrote:
I have Broken objects, but it is impossible to get its state in Zope 2.8. In Zope 2.6 Broken objects have states, what i uses to migrate its.
I think that was more by luck than by design, but maybe whoever made the change can help you out...
I think this is because DB.classFactory is overrided to use OFS.Uninstalled.BrokenClass, which is bad persistent class.
What makes it a "bad persisten class"?
the __dict__ of all my Broken objects equals to {'_p_changed':None}.
That seems fair...
my_object._p_mtime does not load it`s state.
What makes you think it should? Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Hello Chris Withers, Thursday, September 29, 2005, 2:44:52 PM, you wrote: CW> I think that was more by luck than by design, but maybe whoever made the CW> change can help you out... I think broken object MUST use ZODB.broken.Broken not OFS.Uninstalled.Broken CW> What makes it a "bad persisten class"? it`s not first-class persistent class. xCW> What makes you think it should? load object state -- Best regards, Victor Safronovich NauMen.NauDoc.SoftwareDeveloper http://www.naumen.ru
Victor Safronovich wrote:
Hello zope-dev!
http://www.zope.org/Collectors/Zope/1911
I try to migrate my old database from zope 2.6.1.
I have Broken objects, but it is impossible to get its state in Zope 2.8. In Zope 2.6 Broken objects have states, what i uses to migrate its. I think this is because DB.classFactory is overrided to use OFS.Uninstalled.BrokenClass, which is bad persistent class.
the __dict__ of all my Broken objects equals to {'_p_changed':None}.
my_object._p_mtime does not load it`s state.
Try setting _p_changed=1. Or try accessing some other attribute. If that doesn't work, let me know and I'll look into it. Jim -- Jim Fulton mailto:jim@zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org
Hello Jim Fulton, Thursday, September 29, 2005, 2:57:47 PM, you wrote: JF> Victor Safronovich wrote:
Hello zope-dev!
http://www.zope.org/Collectors/Zope/1911
I try to migrate my old database from zope 2.6.1.
I have Broken objects, but it is impossible to get its state in Zope 2.8. In Zope 2.6 Broken objects have states, what i uses to migrate its. I think this is because DB.classFactory is overrided to use OFS.Uninstalled.BrokenClass, which is bad persistent class.
the __dict__ of all my Broken objects equals to {'_p_changed':None}.
my_object._p_mtime does not load it`s state.
JF> Try setting _p_changed=1. object.__dict__ equals to {'_p_changed':1} JF> Or try accessing some other attribute. object.data AttributeError('data') raise by OFS.Uninstalled.Broken.__getattr__ Inheritance tree of class BrokenClass: + OFS.Uninstalled.BrokenClass + __builtin__.ExplicitAcquirer + ExtensionClass.Base - __builtin__.object + OFS.SimpleItem.Item + ExtensionClass.Base - __builtin__.object + webdav.Resource.Resource + ExtensionClass.Base - __builtin__.object + webdav.Lockable.LockableItem - webdav.EtagSupport.EtagSupport + OFS.CopySupport.CopySource + ExtensionClass.Base - __builtin__.object + App.Management.Tabs + ExtensionClass.Base - __builtin__.object - OFS.Traversable.Traversable + OFS.ZDOM.Element - OFS.ZDOM.Node + AccessControl.Owned.Owned + ExtensionClass.Base - __builtin__.object + App.Undo.UndoSupport + ExtensionClass.Base - __builtin__.object + Persistence.Persistent + persistent.Persistent - __builtin__.object + ExtensionClass.Base - __builtin__.object Contradictions of inherited attributes in class BrokenClass: __delattr__ (wrapper_descriptor) + OFS.Uninstalled.BrokenClass + __builtin__.ExplicitAcquirer + ExtensionClass.Base @ __builtin__.object + OFS.SimpleItem.Item + ExtensionClass.Base # __builtin__.object + webdav.Resource.Resource + ExtensionClass.Base # __builtin__.object + OFS.CopySupport.CopySource + ExtensionClass.Base # __builtin__.object + App.Management.Tabs + ExtensionClass.Base # __builtin__.object + AccessControl.Owned.Owned + ExtensionClass.Base # __builtin__.object + App.Undo.UndoSupport + ExtensionClass.Base # __builtin__.object + Persistence.Persistent # persistent.Persistent # __builtin__.object + ExtensionClass.Base # __builtin__.object __getattribute__ (wrapper_descriptor) + OFS.Uninstalled.BrokenClass + __builtin__.ExplicitAcquirer @ ExtensionClass.Base # __builtin__.object + OFS.SimpleItem.Item # ExtensionClass.Base # __builtin__.object + webdav.Resource.Resource # ExtensionClass.Base # __builtin__.object + OFS.CopySupport.CopySource # ExtensionClass.Base # __builtin__.object + App.Management.Tabs # ExtensionClass.Base # __builtin__.object + AccessControl.Owned.Owned # ExtensionClass.Base # __builtin__.object + App.Undo.UndoSupport # ExtensionClass.Base # __builtin__.object # Persistence.Persistent # persistent.Persistent # __builtin__.object # ExtensionClass.Base # __builtin__.object __setattr__ (wrapper_descriptor) + OFS.Uninstalled.BrokenClass + __builtin__.ExplicitAcquirer + ExtensionClass.Base @ __builtin__.object + OFS.SimpleItem.Item + ExtensionClass.Base # __builtin__.object + webdav.Resource.Resource + ExtensionClass.Base # __builtin__.object + OFS.CopySupport.CopySource + ExtensionClass.Base # __builtin__.object + App.Management.Tabs + ExtensionClass.Base # __builtin__.object + AccessControl.Owned.Owned + ExtensionClass.Base # __builtin__.object + App.Undo.UndoSupport + ExtensionClass.Base # __builtin__.object + Persistence.Persistent # persistent.Persistent # __builtin__.object + ExtensionClass.Base # __builtin__.object __setstate__ (method_descriptor) + OFS.Uninstalled.BrokenClass + __builtin__.ExplicitAcquirer @ ExtensionClass.Base + OFS.SimpleItem.Item # ExtensionClass.Base + webdav.Resource.Resource # ExtensionClass.Base + OFS.CopySupport.CopySource # ExtensionClass.Base + App.Management.Tabs # ExtensionClass.Base + AccessControl.Owned.Owned # ExtensionClass.Base + App.Undo.UndoSupport # ExtensionClass.Base + Persistence.Persistent # persistent.Persistent # ExtensionClass.Base I think __setattr__ and __setstate__ overriden by ExtensionClass, but needfully must be from Persistent. Or classFactory must return ZODB.broken.{Persistent}Broken objects -- Best regards, Victor Safronovich NauMen.NauDoc.SoftwareDeveloper http://www.naumen.ru
So I guess it didn't work. :) I'll look into this. The first step will be to write a test for this. The intent was definately that you would be able to get to a broken object's state. Jim Victor Safronovich wrote:
Hello Jim Fulton,
Thursday, September 29, 2005, 2:57:47 PM, you wrote:
JF> Victor Safronovich wrote:
Hello zope-dev!
http://www.zope.org/Collectors/Zope/1911
I try to migrate my old database from zope 2.6.1.
I have Broken objects, but it is impossible to get its state in Zope 2.8. In Zope 2.6 Broken objects have states, what i uses to migrate its. I think this is because DB.classFactory is overrided to use OFS.Uninstalled.BrokenClass, which is bad persistent class.
the __dict__ of all my Broken objects equals to {'_p_changed':None}.
my_object._p_mtime does not load it`s state.
JF> Try setting _p_changed=1. object.__dict__ equals to {'_p_changed':1}
JF> Or try accessing some other attribute. object.data
AttributeError('data') raise by OFS.Uninstalled.Broken.__getattr__
Inheritance tree of class BrokenClass:
+ OFS.Uninstalled.BrokenClass + __builtin__.ExplicitAcquirer + ExtensionClass.Base - __builtin__.object + OFS.SimpleItem.Item + ExtensionClass.Base - __builtin__.object + webdav.Resource.Resource + ExtensionClass.Base - __builtin__.object + webdav.Lockable.LockableItem - webdav.EtagSupport.EtagSupport + OFS.CopySupport.CopySource + ExtensionClass.Base - __builtin__.object + App.Management.Tabs + ExtensionClass.Base - __builtin__.object - OFS.Traversable.Traversable + OFS.ZDOM.Element - OFS.ZDOM.Node + AccessControl.Owned.Owned + ExtensionClass.Base - __builtin__.object + App.Undo.UndoSupport + ExtensionClass.Base - __builtin__.object + Persistence.Persistent + persistent.Persistent - __builtin__.object + ExtensionClass.Base - __builtin__.object
Contradictions of inherited attributes in class BrokenClass:
__delattr__ (wrapper_descriptor) + OFS.Uninstalled.BrokenClass + __builtin__.ExplicitAcquirer + ExtensionClass.Base @ __builtin__.object + OFS.SimpleItem.Item + ExtensionClass.Base # __builtin__.object + webdav.Resource.Resource + ExtensionClass.Base # __builtin__.object + OFS.CopySupport.CopySource + ExtensionClass.Base # __builtin__.object + App.Management.Tabs + ExtensionClass.Base # __builtin__.object + AccessControl.Owned.Owned + ExtensionClass.Base # __builtin__.object + App.Undo.UndoSupport + ExtensionClass.Base # __builtin__.object + Persistence.Persistent # persistent.Persistent # __builtin__.object + ExtensionClass.Base # __builtin__.object
__getattribute__ (wrapper_descriptor) + OFS.Uninstalled.BrokenClass + __builtin__.ExplicitAcquirer @ ExtensionClass.Base # __builtin__.object + OFS.SimpleItem.Item # ExtensionClass.Base # __builtin__.object + webdav.Resource.Resource # ExtensionClass.Base # __builtin__.object + OFS.CopySupport.CopySource # ExtensionClass.Base # __builtin__.object + App.Management.Tabs # ExtensionClass.Base # __builtin__.object + AccessControl.Owned.Owned # ExtensionClass.Base # __builtin__.object + App.Undo.UndoSupport # ExtensionClass.Base # __builtin__.object # Persistence.Persistent # persistent.Persistent # __builtin__.object # ExtensionClass.Base # __builtin__.object
__setattr__ (wrapper_descriptor) + OFS.Uninstalled.BrokenClass + __builtin__.ExplicitAcquirer + ExtensionClass.Base @ __builtin__.object + OFS.SimpleItem.Item + ExtensionClass.Base # __builtin__.object + webdav.Resource.Resource + ExtensionClass.Base # __builtin__.object + OFS.CopySupport.CopySource + ExtensionClass.Base # __builtin__.object + App.Management.Tabs + ExtensionClass.Base # __builtin__.object + AccessControl.Owned.Owned + ExtensionClass.Base # __builtin__.object + App.Undo.UndoSupport + ExtensionClass.Base # __builtin__.object + Persistence.Persistent # persistent.Persistent # __builtin__.object + ExtensionClass.Base # __builtin__.object
__setstate__ (method_descriptor) + OFS.Uninstalled.BrokenClass + __builtin__.ExplicitAcquirer @ ExtensionClass.Base + OFS.SimpleItem.Item # ExtensionClass.Base + webdav.Resource.Resource # ExtensionClass.Base + OFS.CopySupport.CopySource # ExtensionClass.Base + App.Management.Tabs # ExtensionClass.Base + AccessControl.Owned.Owned # ExtensionClass.Base + App.Undo.UndoSupport # ExtensionClass.Base + Persistence.Persistent # persistent.Persistent # ExtensionClass.Base
I think __setattr__ and __setstate__ overriden by ExtensionClass, but needfully must be from Persistent. Or classFactory must return ZODB.broken.{Persistent}Broken objects
-- Jim Fulton mailto:jim@zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org
Hello Jim Fulton, Thursday, September 29, 2005, 4:34:31 PM, you wrote: JF> So I guess it didn't work. :) JF> I'll look into this. The first step will be to write a test for this. JF> The intent was definately that you would be able to get to a broken object's JF> state. not Test but for example ( if needed i try to spend time to write test ) zopectl> debug Starting debugger (the name "app" is bound to the top-level Zope object)
from Persistence import Persistent class Test(Persistent): ... def __init__(self, id): ... self.id = id ... test1 = Test('test1') test2 = Test('test2') app.test1 = test1 app.test1.test2 = test2 import transaction transaction.commit()
# ctrl + d here zopectl> debug Starting debugger (the name "app" is bound to the top-level Zope object) 2005-09-29 10:50:09 WARNING ZODB Could not import class 'Test' from module '__main__'
test1 = app.test1 test1.__dict__ {'_p_changed': None} test1._p_activate() test1.__dict__ {'_p_changed': None} test1.test2 Traceback (most recent call last): File "<stdin>", line 1, in ? AttributeError: test2 test1.__class__.__bases__ (<class 'OFS.Uninstalled.BrokenClass'>,) conn = test1._p_jar conn.setstate(test1) test1.__dict__ {'test2': <__main__.Test object at 0x4015836c>, 'id': 'test1'} del app.test1 import transaction transaction.commit()
-- Best regards, Victor Safronovich NauMen.NauDoc.SoftwareDeveloper http://www.naumen.ru
Hello Victor Safronovich, Thursday, September 29, 2005, 4:03:17 PM, you wrote: VS> I think __setattr__ and __setstate__ overriden by ExtensionClass, but needfully VS> must be from Persistent. Or classFactory must return VS> ZODB.broken.{Persistent}Broken objects I changed BrolenClass.__bases__ from Acquisition.Explicit, SimpleItem.Item, Persistence.Overridable to Persistence.Overridable, Acquisition.Explicit, SimpleItem.Item, but this is not helped to load state. BUT the code below works :)) shed = app.portal.portal_scheduler # 'shed' is broken object con = shed._p_jar con._setstate( shed ) # this load state successfully -- Best regards, Victor Safronovich NauMen.NauDoc.SoftwareDeveloper http://www.naumen.ru
Victor Safronovich wrote:
Hello zope-dev!
http://www.zope.org/Collectors/Zope/1911
I try to migrate my old database from zope 2.6.1.
I have Broken objects, but it is impossible to get its state in Zope 2.8. In Zope 2.6 Broken objects have states, what i uses to migrate its. I think this is because DB.classFactory is overrided to use OFS.Uninstalled.BrokenClass, which is bad persistent class.
the __dict__ of all my Broken objects equals to {'_p_changed':None}.
my_object._p_mtime does not load it`s state.
Could you tell me more about what you want to happen? I'm not sure what was happening with state in Zope 2.7, despite the fact that I wrote that code. It would be helpful if you could remind me what the behavior was. In Zope 2.8, which is to ay ZODB 3.3 and later, the intent is that the broken objects should provide access to the original state via the attribute __Broken_state__. I guess this state isn't being loaded. I'll write a test and fix as necessary to make sure it is. Jim -- Jim Fulton mailto:jim@zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org
Hello Jim Fulton, Thursday, September 29, 2005, 5:02:46 PM, you wrote: JF> Could you tell me more about what you want to happen? i want to get the states of broken objects, to migrate them. -- Best regards, Victor Safronovich NauMen.NauDoc.SoftwareDeveloper http://www.naumen.ru
participants (3)
-
Chris Withers -
Jim Fulton -
Victor Safronovich