[Zope-dev] Broken objects
Victor Safronovich
vsafronovich at naumen.ru
Thu Sep 29 07:12:42 EDT 2005
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
More information about the Zope-Dev
mailing list