[Checkins] SVN: bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/ can always use class decorators now

jim cvs-admin at zope.org
Sun Apr 29 16:16:54 UTC 2012


Log message for revision 125408:
  can always use class decorators now

Changed:
  U   bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/examples.txt
  U   bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/index.txt
  U   bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/more.txt
  U   bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/static.py

-=-
Modified: bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/examples.txt
===================================================================
--- bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/examples.txt	2012-04-29 16:12:37 UTC (rev 125407)
+++ bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/examples.txt	2012-04-29 16:16:51 UTC (rev 125408)
@@ -311,11 +311,6 @@
   The ``Directory.traverse`` method enables directories to be
   traversed with a name to get to sub-directories or files.
 
-non-decorator syntax
-  We call :func:`scan_class` on the ``Directory`` and ``File`` classes
-  rather than using ``scan_class`` as a decorator so we can use the
-  application with Python 2.4 and Python 2.5.
-
 use of the :class:`bobo.NotFound` exception
   Rather than construct a not-found ourselves, we simply raise
   bobo.NotFound, and let bobo generate the response for us.

Modified: bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/index.txt
===================================================================
--- bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/index.txt	2012-04-29 16:12:37 UTC (rev 125407)
+++ bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/index.txt	2012-04-29 16:16:51 UTC (rev 125408)
@@ -579,10 +579,6 @@
 
 .. -> src
 
-    >>> if sys.version_info < (2, 6):
-    ...     src = src.replace("@bobo.scan_class", "")
-    ...     src += "\nbobo.scan_class(Folder)\nbobo.scan_class(Document)"
-
     >>> update_module('helloapp', src)
     >>> app = webtest.TestApp(bobo.Application(bobo_resources='helloapp'))
 

Modified: bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/more.txt
===================================================================
--- bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/more.txt	2012-04-29 16:12:37 UTC (rev 125407)
+++ bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/more.txt	2012-04-29 16:16:51 UTC (rev 125408)
@@ -225,13 +225,6 @@
 
 .. -> src
 
-    >>> import sys
-    >>> if sys.version_info < (2, 6):
-    ...     src = src.replace("\n at bobo.subroute", "\n#bobo.subroute")
-    ...     src += "\nFolder = bobo.subroute('/docs', scan=True)(Folder)"
-    ...     src = src.replace("\n at bobo.scan_class", "")
-    ...     src += "\nbobo.scan_class(Document)"
-
     >>> update_module('docs', src)
 
 We use the ``bobo_resources`` option to control the URLs we access these
@@ -832,6 +825,7 @@
    def catch_all(bobo_request, action=None):
        return "get request for %r" % (action,)
 
+   @bobo.scan_class
    class User(object):
 
        @bobo.resource("/:userid", method=("POST",))
@@ -846,14 +840,12 @@
        def catch_all(self, bobo_request, id):
            return "get user with id %r" % (id,)
 
-   bobo.scan_class(User)
-
+   @bobo.scan_class
    class Thing(object):
 
        @bobo.resource("/:id", method=("PUT",))
        def put(self, bobo_request, id):
            return "put thing with id %r" % (id,)
-   bobo.scan_class(Thing)
 
    @bobo.subroute("/users")
    def users(bobo_request):

Modified: bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/static.py
===================================================================
--- bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/static.py	2012-04-29 16:12:37 UTC (rev 125407)
+++ bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/static.py	2012-04-29 16:16:51 UTC (rev 125408)
@@ -1,5 +1,6 @@
 import bobo, mimetypes, os, webob
 
+ at bobo.scan_class
 class Directory:
 
     def __init__(self, root, path=None):
@@ -35,8 +36,7 @@
         else:
             return File(path)
 
-bobo.scan_class(Directory)
-
+ at bobo.scan_class
 class File:
     def __init__(self, path):
         self.path = path
@@ -53,5 +53,3 @@
             raise bobo.NotFound
 
         return response
-
-bobo.scan_class(File)



More information about the checkins mailing list