[Checkins] SVN: Sandbox/ulif/grokui.codebrowser/src/grokui/codebrowser/README.txt Test grokui.codebrowser.
Uli Fouquet
uli at gnufix.de
Sat Mar 20 09:41:41 EDT 2010
Log message for revision 110083:
Test grokui.codebrowser.
Changed:
U Sandbox/ulif/grokui.codebrowser/src/grokui/codebrowser/README.txt
-=-
Modified: Sandbox/ulif/grokui.codebrowser/src/grokui/codebrowser/README.txt
===================================================================
--- Sandbox/ulif/grokui.codebrowser/src/grokui/codebrowser/README.txt 2010-03-19 23:37:45 UTC (rev 110082)
+++ Sandbox/ulif/grokui.codebrowser/src/grokui/codebrowser/README.txt 2010-03-20 13:41:40 UTC (rev 110083)
@@ -1,84 +1,61 @@
:doctest:
-:layer: grokui.zodbbrowser.tests.GrokZODBBrowserFunctionalLayer
+:layer: grokui.codebrowser.tests.GrokCodeBrowserFunctionalLayer
-We start a testbrowser to browse a local ZODB:
+We start a testbrowser to browse local code:
>>> 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
+When browsing the root folder, we will be redirected to the code
browser, which is part of the grok UI framework:
>>> browser.open('http://localhost/')
>>> browser.url
- 'http://localhost/++grokui++/@@zodbbrowser'
+ 'http://localhost/++grokui++/@@codebrowser'
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'>
+ >>> browser.getLink('Code browser')
+ <Link text='Code browser' url='http://localhost/++grokui++/codebrowser'>
-Every object stored in a ZODB has a unique object ID. If we know that
-OID, we can browse the object directly:
+The codebrowser main screen provides an alphabetically sorted
+selection of top-level packages to browse. Also the ``zope``,
+``grokcore``, and ``grokui`` namespaces will be available. We browse
+some parts of ``grokui.codebrowser``:
- >>> from ZODB.utils import u64
- >>> root = getRootFolder()
+ >>> print browser.contents
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ ...
+ <a href="http://localhost/++grokui++/codebrowser/code/grokui">grokui</a>
+ ...
-The ``_p_oid`` attribute of a ZODB-stored object contains the OID as
-binary data (8 bytes) that we transform into an int using the ``u64``
-helper function from ``ZODB.utils``.
+As we can see, a certain dotted name can be reached via an URL like::
- >>> root_oid = u64(root._p_oid)
- >>> browser.open(
- ... 'http://localhost/++grokui++/@@zodbbrowser/%s' % root_oid)
+ http://localhost/++grokui++/codebrowser/code/DOTTED/NAME/OF/CODE
-A root folder normally contains a local site manager names
-``_sm``. A link to this site manager is available:
+where the dotted name is in fact a 'slashed name'. For instance, to
+browse the ``grokui.codebrowser`` package we use::
- >>> browser.getLink('_sm')
- <Link text='_sm' url='http://localhost/++grokui++/zodbbrowser/...>
+ http://localhost/++grokui++/codebrowser/code/grokui/codebrowser
-By default you will only see a limited set of member for each browsed
-object, these members, which are stored in ZODB separated from the
-currently browsed object. Not displayed are other members, that are
-'native' attributes or methods of a browsed object.
+Opening this screen we will see contained text files, ZCML files,
+subpackages, modules, and more infos:
- >>> 'getSiteManager(self)' in browser.contents
- False
-
-You can, however, enable displaying of those members by ticking `show
-all members` box and clicking the `Update` button:
-
- >>> browser.getControl('show all members')
- <ItemControl name='show_all' type='checkbox' ... selected=False>
- >>> browser.getControl('show all members').selected = True
- >>> browser.getControl('Update').click()
-
-Now the ``getSiteManager()`` method is displayed:
-
- >>> 'getSiteManager(self)' in browser.contents
- True
-
-We can also enable or disable displaying of doc strings of
-members (disabled by default). For example the docstring for a folders
-``keys()`` method tells us:
-
- >>> browser.getControl('show docstrings').selected = True
- >>> browser.getControl('Update').click()
+ >>> browser.open(
+ ... 'http://localhost/++grokui++/codebrowser/code/grokui/codebrowser')
>>> print browser.contents
<html xmlns="http://www.w3.org/1999/xhtml">
...
- ...<pre>Return a sequence-like object containing the names
- associated with the objects that appear in the folder</pre>
+ Contained text files:
...
+ Contained ZCML files:
+ ...
+ Contained subpackages:
+ ...
+ Contained modules:
+ ...
-We disable both, displaying of docstrings and non-persistent members
-to get shorter output:
-
- >>> browser.getControl('show docstrings').selected = False
- >>> browser.getControl('show all members').selected = False
- >>> browser.getControl('Update').click()
More information about the checkins
mailing list