[ZODB-Dev] ZODB viewer script on ActiveState Python Cookbook

Tim Peters tim at zope.com
Fri Apr 8 14:23:02 EDT 2005


[Chris Cioffi]
> Just an FYI to all that I uploaded my first pass at a script for viewing
> a ZODB data file.  This is a trivial implementation and probably need
> some work, especially wrt accessing a ZODB via ZEO.

It's a very cool thing about ZEO that normally all you need to change is one
line, from opening a FileStorage to opening a ClientStorage.  The only
complication then is parsing the ZEO server address (which may be a
host:port pair, or a Unix domain socket).  Maybe you could incorporate
ZConfig to make that "easy" <wink>.

> This script uses wxPython so it's probably a bit oriented towards
> Windows, I'll address that once my Mac Mini comes in. :-)

Hmm.  I'm running on Windows, but don't have wxPython installed.  Tk is the
common denominator across platforms; people can legitimately argue about
whether it's the _lowest_ common denominator.  I'd say you should use
whatever you like best.
 
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/409012
>
> Any feedback would be appreciated...

One immediate suggestion:  there's a very long line in the code, starting
with:

        self.db_layout_tree = wx.TreeCtrl(self.window_1_pane_1,

ASPN reflows the text paragraphs to the width of that line too, so it's very
hard to read the Description and Discussion (unless I maximize the browser
window, I have to scroll left and right).  So rewrite that line, maybe like:

        self.db_layout_tree = wx.TreeCtrl(self.window_1_pane_1, -1,
                                           style=wx.TR_HAS_BUTTONS |
                                                 wx.TR_LINES_AT_ROOT |
                                                 wx.TR_DEFAULT_STYLE |
                                                 wx.SUNKEN_BORDER)

The Python style guide:

    http://www.python.org/peps/pep-0008.html

requests:

    please limit all lines to a maximum of 79 characters

for pragmatic reasons like this.



More information about the ZODB-Dev mailing list