[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/generations/ Cosmetic fixes.

Gintautas Miliauskas gintas at pov.lt
Sun Jan 30 14:06:17 EST 2005


Log message for revision 28983:
  Cosmetic fixes.
  

Changed:
  U   Zope3/trunk/src/zope/app/generations/browser/managers.py
  U   Zope3/trunk/src/zope/app/generations/generations.py
  U   Zope3/trunk/src/zope/app/generations/tests.py
  U   Zope3/trunk/src/zope/app/generations/utility.py

-=-
Modified: Zope3/trunk/src/zope/app/generations/browser/managers.py
===================================================================
--- Zope3/trunk/src/zope/app/generations/browser/managers.py	2005-01-30 16:50:44 UTC (rev 28982)
+++ Zope3/trunk/src/zope/app/generations/browser/managers.py	2005-01-30 19:06:17 UTC (rev 28983)
@@ -35,7 +35,7 @@
         return self.request.publication.db
 
     def evolve(self):
-        """Perform a requested evolution 
+        """Perform a requested evolution
 
            This method needs to use the component architecture, so
            we'll set it up:
@@ -90,12 +90,12 @@
            We'll also increase the generation of app1:
 
              >>> app1.generation = 2
-             
+
            Now we can create our view:
 
              >>> view = Managers(None, request)
 
-           Now, if we call it's `evolve` method, it should see that the
+           Now, if we call its `evolve` method, it should see that the
            app1 evolve button was pressed and evolve app1 to the next
            generation.
 
@@ -105,7 +105,7 @@
              2
 
            The demo evolver just writes the generation to a database key:
-           
+
              >>> from zope.app.generations.demo import key
              >>> conn.root()[key]
              (2,)
@@ -148,7 +148,7 @@
              2
              >>> conn.root()[key]
              (2,)
-           
+
            We'd better clean upp:
 
              >>> db.close()
@@ -234,12 +234,12 @@
              >>> app1.generation += 1
 
            so we can evolve it.
-             
+
            Now we can create our view:
 
              >>> view = Managers(None, request)
 
-           We call it's applications method to get data about
+           We call its applications method to get data about
            application generations. We are required to call evolve
            first:
 
@@ -250,19 +250,20 @@
              >>> for info in data:
              ...     print info['id']
              ...     print info['min'], info['max'], info['generation']
-             ...     print 'evolve?', info['evolve']
+             ...     print 'evolve?', info['evolve'] or None
              foo.app1
              0 2 1
              evolve? evolve-app-foo.app1
              foo.app2
              0 0 0
-             evolve? 
+             evolve? None
 
-           We'd better clean upp:
+           We'd better clean up:
 
              >>> db.close()
              >>> tearDown()
-           """
+
+        """
         result = []
 
         db = self._getdb()
@@ -275,7 +276,7 @@
                 manager = managers.get(key)
                 if manager is None:
                     continue
-                
+
                 result.append({
                     'id': key,
                     'min': manager.minimum_generation,

Modified: Zope3/trunk/src/zope/app/generations/generations.py
===================================================================
--- Zope3/trunk/src/zope/app/generations/generations.py	2005-01-30 16:50:44 UTC (rev 28982)
+++ Zope3/trunk/src/zope/app/generations/generations.py	2005-01-30 19:06:17 UTC (rev 28983)
@@ -80,7 +80,7 @@
          >>> context.connection.close()
          >>> conn.close()
          >>> db.close()
-         
+
        """
 
     zope.interface.implements(ISchemaManager)
@@ -94,8 +94,8 @@
                              minimum_generation)
 
         if generation and not package_name:
-            raise ValueError("A package  name must be supplied if the"
-                             "generation is non-zero")
+            raise ValueError("A package name must be supplied if the"
+                             " generation is non-zero")
 
         self.minimum_generation = minimum_generation
         self.generation = generation
@@ -117,9 +117,9 @@
             "%s.evolve%d" % (self.package_name, generation),
             {}, {}, ['*'])
         return evolver.evolve.__doc__
-        
-        
 
+
+
 class Context(object):
     pass
 
@@ -146,15 +146,15 @@
       ...     zope.interface.implements(ISchemaManager)
       ...
       ...     erron = None # Raise an error is asked to evolve to this
-      ... 
+      ...
       ...     def __init__(self, name, minimum_generation, generation):
       ...         self.name, self.generation = name, generation
       ...         self.minimum_generation = minimum_generation
-      ... 
+      ...
       ...     def evolve(self, context, generation):
       ...         if generation == self.erron:
       ...             raise ValueError(generation)
-      ... 
+      ...
       ...         context.connection.root()[self.name] = generation
 
     We also need to set up the component system, since we'll be
@@ -171,9 +171,9 @@
       >>> app2 = FauxApp('app2', 5, 11)
       >>> ztapi.provideUtility(ISchemaManager, app2, name='app2')
 
-    If we great a new database, and evolve it, we'll simply update
+    If we create a new database, and evolve it, we'll simply update
     the generation data:
-    
+
       >>> from ZODB.tests.util import DB
       >>> db = DB()
       >>> conn = db.open()
@@ -202,13 +202,13 @@
       2
       >>> root[generations_key]['app2']
       11
-    
+
     And that the database was updated for that application:
 
       >>> root.get('app1')
       2
       >>> root.get('app2')
-    
+
     If there is an error updating a particular generation, but the
     generation is greater than the minimum generation, then we won't
     get an error from evolve, but we will get a log message.
@@ -238,7 +238,7 @@
 
     Then we'll get an error if we try to evolve, since we can't get
     past 3 and 3 is less than 5:
-    
+
       >>> evolve(db)
       Traceback (most recent call last):
       ...
@@ -286,7 +286,6 @@
     Now, if we use EVOLVEMINIMUM instead, we'll evolve to the minimum
     generation:
 
-
       >>> evolve(db, EVOLVEMINIMUM)
       >>> conn.sync()
       >>> root[generations_key]['app1']
@@ -307,11 +306,12 @@
       GenerationTooHigh: (5, u'app1', 2)
 
     We'd better clean up:
-    
+
       >>> handler.uninstall()
       >>> conn.close()
       >>> db.close()
       >>> tearDown()
+
     """
     conn = db.open()
     try:

Modified: Zope3/trunk/src/zope/app/generations/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/generations/tests.py	2005-01-30 16:50:44 UTC (rev 28982)
+++ Zope3/trunk/src/zope/app/generations/tests.py	2005-01-30 19:06:17 UTC (rev 28983)
@@ -17,10 +17,11 @@
 """
 
 import unittest
-from zope.testing.doctestunit import DocTestSuite
+from zope.testing.doctestunit import DocTestSuite, DocFileSuite
 
 def test_suite():
     return unittest.TestSuite((
+        DocFileSuite('README.txt'),
         DocTestSuite('zope.app.generations.generations'),
         DocTestSuite('zope.app.generations.utility'),
         ))

Modified: Zope3/trunk/src/zope/app/generations/utility.py
===================================================================
--- Zope3/trunk/src/zope/app/generations/utility.py	2005-01-30 16:50:44 UTC (rev 28982)
+++ Zope3/trunk/src/zope/app/generations/utility.py	2005-01-30 19:06:17 UTC (rev 28983)
@@ -78,7 +78,7 @@
 def findObjectsProviding(root, interface):
     """Find all objects in the root that provide the specified interface.
 
-    All sub-objects of the root will also be searched recursively. 
+    All sub-objects of the root will also be searched recursively.
 
     Example:
 
@@ -88,7 +88,7 @@
     >>> class IB(Interface):
     ...     pass
     >>> class IC(IA):
-    ...     pass    
+    ...     pass
 
     >>> class A(dict):
     ...     implements(IA)



More information about the Zope3-Checkins mailing list