[ZODB-Dev] Tool for exploring raw ZODB data

Jeff Sasmor jsasmor@gte.net
Fri, 14 Feb 2003 17:56:03 -0500


"Christian Reis" <kiko@async.com.br> wrote:

>Looks cool, but I have a question. How are the objects organized into
>paths, as this seems to be hardcoded into the application. Was it
>designed for something like Zope uses?


No, actually it doesn't matter what system you're using; this works
at too low a level to care. The ZODB is the same no matter
what's 'above' it. Even in Zope, there's a path from the Root Folder
thru folders, etc.

The so-called 'Traversal'  code in Zope follows the path
(RootFolder/Folder/Object), so you just
specify the path in this tool with + signs as the element separators
rather than /.


The root object in a Zope zodb is called Application. I took a
new Data.fs from a Zope 2.6 install and did the following tests-
the first just shows the contents of the Application object, the
second shows Application+standard_html_header (i.e., the
standard_html_header in the Root Folder).

So you can see that this tool is actually platform independent.
Just think of the + as a '.' or a '/'.

Note that you can try to access a subobject like
Application+_objects, as this is not a class type like
a regular subobject in the "object path" you'll get
a tuple unpack error. This tool gets the object,
you have to process the subobjects that aren't
a class (i.e., without an OID and Module/Class info
tuple) yourself. It's not that hard.

It wasn't designed for Zope, but I think if you're developing
a Zope app it might be cool to use this to see if you have
the data in the ZODB that you _think_ you have. Perhaps
it would be handy when debugging unusual problems. It's
also instructive if you're trying to understand how this
layer of the ZODB works.

HTH

jms

---example--

C:\Documents and Settings\jms\DESKTOP\PyFrame\src\pfng\Zdirect>\python22\python.exe ZODB_direct_load.py Data.fs Application

finding object Application

standard_html_footer : <type 'tuple'> :: ('\x00\x00\x00\x00\x00\x00\x00\x07', ('OFS.DTMLMethod', 'DTMLMethod'))
acl_users : <type 'tuple'> :: ('\x00\x00\x00\x00\x00\x00\x00\x04', ('AccessControl.User', 'UserFolder'))
__allow_groups__ : <type 'tuple'> :: ('\x00\x00\x00\x00\x00\x00\x00\x04', ('AccessControl.User', 'UserFolder'))
Control_Panel : <type 'tuple'> :: ('\x00\x00\x00\x00\x00\x00\x00\x06', ('App.ApplicationManager', 'ApplicationManager'))
_objects : <type 'tuple'> :: ({'meta_type': 'User Folder', 'id': 'acl_users'}, {'meta_type': 'Control Panel', 'id':
'Control_Panel'},
{'meta_type': 'DTML Method', 'id': 'standard_html_header'}, {'meta_type': 'DTML Method', 'id': 'standard_html_footer'},
{'meta_type': 'DTML Method', 'id': 'standard_e
rror_message'}, {'meta_type': 'DTML Method', 'id': 'index_html'})
standard_error_message : <type 'tuple'> :: ('\x00\x00\x00\x00\x00\x00\x00\x05', ('OFS.DTMLMethod', 'DTMLMethod'))
_product_meta_types : <type 'tuple'> :: ()
index_html : <type 'tuple'> :: ('\x00\x00\x00\x00\x00\x00\x00T', ('OFS.DTMLMethod', 'DTMLMethod'))
standard_html_header : <type 'tuple'> :: ('\x00\x00\x00\x00\x00\x00\x00\x03', ('OFS.DTMLMethod', 'DTMLMethod'))

C:\Documents and Settings\jms\DESKTOP\PyFrame\src\pfng\Zdirect>\python22\python.exe ZODB_direct_load.py Data.fs
Application+standard_html_header

finding object Application+standard_html_header

_vars : <type 'dict'> :: {}
raw : <type 'str'> :: <html><head><title><dtml-var title_or_id></title></head><body bgcolor="#FFFFFF">
__name__ : <type 'str'> :: standard_html_header
globals : <type 'dict'> :: {}
title : <type 'str'> :: Standard Html Header

C:\Documents and Settings\jms\DESKTOP\PyFrame\src\pfng\Zdirect>


#--------------------------------
Jeff Sasmor
jeff@sasmor.com
----- Original Message -----
From: "Christian Reis" <kiko@async.com.br>
To: "Jeff Sasmor" <jsasmor@gte.net>
Cc: <zodb-dev@zope.org>
Sent: Friday, February 14, 2003 1:56 PM
Subject: Re: [ZODB-Dev] Tool for exploring raw ZODB data


On Fri, Feb 14, 2003 at 01:32:06PM -0500, Jeff Sasmor wrote:
> In case it's of any use to anyone else
> besides myself, I've posted the source code
> for a simple tool I've developed
> at: http://www.pyframe.com/zodb_direct

Looks cool, but I have a question. How are the objects organized into
paths, as this seems to be hardcoded into the application. Was it
designed for something like Zope uses?

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL

_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev