[Zope3-checkins] CVS: Zope3/src/zope/app/apidoc/viewmodule - __init__.py:1.3 browser.py:1.7

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Mar 29 21:01:21 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/apidoc/viewmodule
In directory cvs.zope.org:/tmp/cvs-serv12615/src/zope/app/apidoc/viewmodule

Modified Files:
	__init__.py browser.py 
Log Message:


Make use of the new zope.app.apidoc.tests.pprint function.




=== Zope3/src/zope/app/apidoc/viewmodule/__init__.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/apidoc/viewmodule/__init__.py:1.2	Sun Mar 28 18:41:39 2004
+++ Zope3/src/zope/app/apidoc/viewmodule/__init__.py	Mon Mar 29 21:01:18 2004
@@ -105,11 +105,9 @@
 
         Example::
 
-          >>> import pprint
-          >>> pprint = pprint.PrettyPrinter(width=69).pprint
+          >>> from zope.app.apidoc.tests import pprint
           >>> module = ViewModule()        
           >>> map = module.getSkinLayerMapping().items()
-          >>> map.sort()
           >>> pprint(map)
           [('default', ('default',)),
            ('skinA', ('default',)),


=== Zope3/src/zope/app/apidoc/viewmodule/browser.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/apidoc/viewmodule/browser.py:1.6	Mon Mar 29 10:08:34 2004
+++ Zope3/src/zope/app/apidoc/viewmodule/browser.py	Mon Mar 29 21:01:18 2004
@@ -38,21 +38,18 @@
 
         Example::
 
-          >>> import pprint
-          >>> pprint = pprint.PrettyPrinter(width=69).pprint
+          >>> from zope.app.apidoc.tests import pprint
           >>> menu = Menu()
           >>> types = menu.getPresentationTypes()
-          >>> types = [type.items() for type in types]
-          >>> types.sort()
           >>> pprint(types)
-          [[('path', 'zope.publisher.interfaces.browser.IBrowserRequest'),
-            ('name', 'IBrowserRequest')],
-           [('path', 'zope.publisher.interfaces.ftp.IFTPRequest'),
-            ('name', 'IFTPRequest')],
-           [('path', 'zope.publisher.interfaces.http.IHTTPRequest'),
-            ('name', 'IHTTPRequest')],
-           [('path', 'zope.publisher.interfaces.xmlrpc.IXMLRPCRequest'),
-            ('name', 'IXMLRPCRequest')]]
+          [[('name', 'IHTTPRequest'),
+            ('path', 'zope.publisher.interfaces.http.IHTTPRequest')],
+           [('name', 'IBrowserRequest'),
+            ('path', 'zope.publisher.interfaces.browser.IBrowserRequest')],
+           [('name', 'IXMLRPCRequest'),
+            ('path', 'zope.publisher.interfaces.xmlrpc.IXMLRPCRequest')],
+           [('name', 'IFTPRequest'),
+            ('path', 'zope.publisher.interfaces.ftp.IFTPRequest')]]
         """
         return [{'name': path.split('.')[-1], 'path': path}
             for path in ['zope.publisher.interfaces.http.IHTTPRequest',
@@ -67,8 +64,6 @@
 
         Example::
 
-          >>> import pprint
-          >>> pprint = pprint.PrettyPrinter(width=69).pprint
           >>> menu = Menu()
           >>> menu.getInterfaceIds()
           ['IBrowserRequest', 'IFoo']
@@ -86,21 +81,17 @@
 
         Example::
 
-          >>> import pprint
-          >>> pprint = pprint.PrettyPrinter(width=69).pprint
+          >>> from zope.app.apidoc.tests import pprint
           >>> from zope.app.apidoc.viewmodule import ViewModule
           >>> view = SkinLayer()
           >>> view.context = ViewModule()
           >>> skins = view.getSkins(False)
-          >>> skins = [skin.items() for skin in skins]
-          >>> skins = [skin for skin in skins if skin.sort() is None]
-          >>> skins.sort()
           >>> pprint(skins)
           [[('layers', ('default',)), ('name', 'default')],
            [('layers', ('default',)), ('name', 'skinA')],
+           [('layers', ('layer5', 'layer4', 'default')), ('name', 'skinB')],
            [('layers', ('layer4', 'layer2', 'layer1', 'default')),
-            ('name', 'skinC')],
-           [('layers', ('layer5', 'layer4', 'default')), ('name', 'skinB')]]
+            ('name', 'skinC')]]
         """
         info = [{'name': skin, 'layers': layers}
                 for skin, layers in self.context.getSkinLayerMapping().items()]
@@ -114,14 +105,14 @@
 
     Examples::
 
-      >>> from tests import pprintDict
+      >>> from zope.app.apidoc.tests import pprint
 
       The factory is a SimpleViewClass for a Page Template:
 
       >>> from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
       >>> view = SimpleViewClass('index.pt')
       >>> info = _getFactoryData(view)
-      >>> pprintDict(info)
+      >>> pprint(info)
       [('path', 'zope.app.pagetemplate.simpleviewclass.simple'),
        ('referencable', True),
        ('resource', None),
@@ -131,7 +122,7 @@
       The factory is a simple type:
       
       >>> info = _getFactoryData(3)
-      >>> pprintDict(info)
+      >>> pprint(info)
       [('path', None),
        ('referencable', False),
        ('resource', None),
@@ -144,7 +135,7 @@
       ...     pass
 
       >>> info = _getFactoryData(Factory())
-      >>> pprintDict(info)
+      >>> pprint(info)
       [('path', 'zope.app.apidoc.viewmodule.browser.Factory'),
        ('referencable', True),
        ('resource', None),
@@ -154,7 +145,7 @@
       The factory is a class or type:
 
       >>> info = _getFactoryData(Factory)
-      >>> pprintDict(info)
+      >>> pprint(info)
       [('path', 'zope.app.apidoc.viewmodule.browser.Factory'),
        ('referencable', True),
        ('resource', None),
@@ -228,8 +219,7 @@
 
         Example::
 
-          >>> import pprint
-          >>> pprint = pprint.PrettyPrinter(width=69).pprint
+          >>> from zope.app.apidoc.tests import pprint
           >>> from zope.publisher.browser import TestRequest
         
           >>> form ={'iface': 'IFoo',
@@ -239,10 +229,6 @@
           >>> layer['name']
           'default'
           >>> view = layer['views'][0]
-          >>> view['factory'] = view['factory'].items()
-          >>> view['factory'].sort()
-          >>> view = view.items()
-          >>> view.sort()
           >>> pprint(view)
           [('factory',
             [('path', 'zope.app.apidoc.viewmodule.tests.FooView'),




More information about the Zope3-Checkins mailing list