[Checkins] SVN: Sandbox/ulif/grokui.zodbbrowser/src/grokui/zodbbrowser/README.txt Add first basic tests.
Uli Fouquet
uli at gnufix.de
Sat Mar 6 10:56:12 EST 2010
Log message for revision 109706:
Add first basic tests.
Changed:
U Sandbox/ulif/grokui.zodbbrowser/src/grokui/zodbbrowser/README.txt
-=-
Modified: Sandbox/ulif/grokui.zodbbrowser/src/grokui/zodbbrowser/README.txt
===================================================================
--- Sandbox/ulif/grokui.zodbbrowser/src/grokui/zodbbrowser/README.txt 2010-03-06 15:55:31 UTC (rev 109705)
+++ Sandbox/ulif/grokui.zodbbrowser/src/grokui/zodbbrowser/README.txt 2010-03-06 15:56:12 UTC (rev 109706)
@@ -0,0 +1,37 @@
+
+:doctest:
+:layer: grokui.zodbbrowser.tests.GrokZODBBrowserFunctionalLayer
+
+We start a testbrowser to browse a local ZODB:
+
+ >>> from zope.testbrowser.testing import Browser
+ >>> browser = Browser()
+ >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+ >>> browser.handleErrors = True
+
+When browsing the root folder, we will be redirected to the ZODB
+browser, which is part of the grok UI framework:
+
+ >>> browser.open('http://localhost/')
+ >>> browser.url
+ 'http://localhost/++grokui++/@@zodbbrowser'
+
+There is a link available, that will always bring us back to the ZODB
+browsers root:
+
+ >>> browser.getLink('ZODB browser')
+ <Link text='ZODB browser' url='http://localhost/++grokui++/zodbbrowser'>
+
+Every object stored in a ZODB has a unique object ID. If we know that
+OID, we can browse the object directly:
+
+ >>> from ZODB.utils import u64
+ >>> root = getRootFolder()
+
+The ``_p_oid`` attribute of a ZODB-stored object contains binary data
+(8 bytes) that we transform into an int using the ``u64`` helper
+function from ``ZODB.utils``.
+
+ >>> root_oid = u64(root._p_oid)
+ >>> browser.open(
+ ... 'http://localhost/++grokui++/@@zodbbrowser/%s' % root_oid)
More information about the checkins
mailing list