[Checkins] SVN: z3c.blobfile/trunk/ Improved tests for evolution script and fixed a bug.

Uwe Oestermeier u.oestermeier at iwm-kmrc.de
Thu Nov 15 03:36:33 EST 2007


Log message for revision 81848:
  Improved tests for evolution script and fixed a bug.

Changed:
  U   z3c.blobfile/trunk/buildout.cfg
  U   z3c.blobfile/trunk/setup.py
  U   z3c.blobfile/trunk/src/z3c/blobfile/blobfile.txt
  U   z3c.blobfile/trunk/src/z3c/blobfile/generations/evolve1.py

-=-
Modified: z3c.blobfile/trunk/buildout.cfg
===================================================================
--- z3c.blobfile/trunk/buildout.cfg	2007-11-14 22:13:07 UTC (rev 81847)
+++ z3c.blobfile/trunk/buildout.cfg	2007-11-15 08:36:31 UTC (rev 81848)
@@ -6,4 +6,5 @@
 [test]
 recipe = zc.recipe.testrunner
 eggs = z3c.blobfile [test]
+zcml = z3c.blobfile-overrides
 defaults = ['--tests-pattern', '^f?tests$', '-v']
\ No newline at end of file

Modified: z3c.blobfile/trunk/setup.py
===================================================================
--- z3c.blobfile/trunk/setup.py	2007-11-14 22:13:07 UTC (rev 81847)
+++ z3c.blobfile/trunk/setup.py	2007-11-15 08:36:31 UTC (rev 81848)
@@ -58,7 +58,8 @@
       extras_require = dict(test=['zope.app.file',
                                   'zope.app.testing',
                                   'zope.app.securitypolicy',
-                                  'zope.app.zcmlfiles']),
+                                  'zope.app.zcmlfiles',
+                                  'zope.testbrowser']),
       install_requires=['setuptools',
                         'ZODB3',
                         'zope.app.publication',

Modified: z3c.blobfile/trunk/src/z3c/blobfile/blobfile.txt
===================================================================
--- z3c.blobfile/trunk/src/z3c/blobfile/blobfile.txt	2007-11-14 22:13:07 UTC (rev 81847)
+++ z3c.blobfile/trunk/src/z3c/blobfile/blobfile.txt	2007-11-15 08:36:31 UTC (rev 81848)
@@ -57,6 +57,20 @@
     ...     print record.getMessage()
     Unknown ...interfaces.IFile implementation z3c.blobfile.testing.MyFile
   
+After the evolution step the class types have changed to the z3c.blobfile
+implementations:
+
+    >>> import z3c.blobfile
+    >>> isinstance(root[u'file'], z3c.blobfile.file.File)
+    True
+    >>> isinstance(root[u'image'], z3c.blobfile.image.Image)
+    True
+
+Only the custom implementations remain untouched:
+
+    >>> isinstance(root[u'custom'], testing.MyFile)
+    True
+    
 The file data remain the same ...
 
     >>> root[u'file'].data
@@ -67,14 +81,19 @@
     >>> root[u'image'].data == testing.zptlogo
     True
     
-and so are the annotations:
+and so do the annotations:
 
     >>> IZopeDublinCore(root[u'file']).created == t1
     True
     >>> IZopeDublinCore(root[u'file']).title
     u'No evolution'
     
+Even implementation details like the _data attribute still work:
 
+    >>> root[u'file']._data
+    'A text file'
+    
+    
 Adding Blob Files
 -----------------
 

Modified: z3c.blobfile/trunk/src/z3c/blobfile/generations/evolve1.py
===================================================================
--- z3c.blobfile/trunk/src/z3c/blobfile/generations/evolve1.py	2007-11-14 22:13:07 UTC (rev 81847)
+++ z3c.blobfile/trunk/src/z3c/blobfile/generations/evolve1.py	2007-11-15 08:36:31 UTC (rev 81848)
@@ -37,10 +37,12 @@
     Doesn't throw an ObjectModify event.
     """
     for file in findObjectsProviding(root, IFile):
-        if isinstance(file, zope.app.file.File):
+    
+        if isinstance(file, zope.app.file.Image):
+            changeImplementation(file, z3c.blobfile.image.Image)
+        elif isinstance(file, zope.app.file.File):
             changeImplementation(file, z3c.blobfile.file.File)
-        elif isinstance(file, zope.app.file.Image):
-            changeImplementation(file, z3c.blobfile.image.Image)
+            
         else:
             logging.getLogger('z3c.blobfile.generations').warn(
             'Unknown zope.app.file.interfaces.IFile implementation %s.%s' % (



More information about the Checkins mailing list