[Grok-dev] Re: browsing and modifying persistent objects in zodb

Craeg Strong cstrong at arielpartners.com
Sun Jun 22 15:46:59 EDT 2008

Uli Fouquet wrote:
> Hi there,
> Craeg Strong wrote:
>> I would like to see full capability for editing/replacing/creating new 
>> objects, where some of that functionality may be provided via escaping to
>> an interactive session, for example a little TTW interface to a python 
>> interpreter.  
>> The ability to dynamically/interactively fix "broken" objects in my app 
>> in ZODB would be IMO a major use case for this facility.
> I have not much experience with broken objects, although I managed the
> admin UI to recognize and delete broken objects on request (something,
> that is difficult with the stock Zope 3 UI).
> To build such a feature (fixing of broken objects) I would appreciate
> any hints on how people cope with that problem normally. Please note,
> that you can often start your Grok instance in debug mode (`bin/zopectl
> debug`). Then you get a Python interpreter with the ZODB data available,
> where you can modify objects manually. How would you fix any broken
> objects in such an interactive Python shell at least in simple use cases
> (vanished attributes for instance)?
If you can get ahold of object instances in the ZODB, then you can 
presumably do whatever you need to in the interactive shell.  I suppose 
if all else fails you could create another instance of an object (using 
the new schema) and then manually copy over all the attributes you want 
from the old broken instance.  When you finish, you can delete the old 
instance and make the new instance take its place (a sort of selective 
deep copy).

I suppose there would be a number of specific cases that tend to crop 
up--all the various refactorings.  Through the shell you can do whatever 
you need toby hand, but we can eventually provide some convenience 
shortcuts.  I don't have enough recent experience with ZODB to know what 
those specific cases might be-- I am just getting serious with Zope 
again after a long hiatus.  But I remember the old "broken object" icon 
in Zope2 TTW fondly ;-)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20080622/7cacf7e7/attachment.html

More information about the Grok-dev mailing list