CVS: Products/Zelenium - CHANGES.txt:1.17 zuite.py:1.10

Tres Seaver <[email protected]>
Newsgroups gmane.comp.web.zope.public-cvs
Message-ID <[email protected]>
Update of /cvs-repository/Products/Zelenium
In directory cvs.zope.org:/tmp/cvs-serv1090

Modified Files:
	CHANGES.txt zuite.py 
Log Message:


  - Make ZIPfile generation work with nested suites.


=== Products/Zelenium/CHANGES.txt 1.16 => 1.17 ===
--- Products/Zelenium/CHANGES.txt:1.16	Mon May  2 20:40:05 2005
+++ Products/Zelenium/CHANGES.txt	Mon May  2 21:03:23 2005
@@ -1,5 +1,9 @@
 Zelenium Product Changelog
 
+  After Zelenium-0.4.1
+
+    - Make ZIPfile generation work with nested suites.
+
   Zelenium-0.4.1 (2005/05/02)
 
     - CVS tag:  'Zelenium-0_4_1'


=== Products/Zelenium/zuite.py 1.9 => 1.10 ===
--- Products/Zelenium/zuite.py:1.9	Thu Apr 28 17:12:42 2005
+++ Products/Zelenium/zuite.py	Mon May  2 21:03:23 2005
@@ -465,29 +465,47 @@
         stream = StringIO.StringIO()
         archive = zipfile.ZipFile( stream, 'w' )
 
+        self._getZipFile_recurse( archive )
+
+        for k, v in _SUPPORT_FILES.items():
+            archive.writestr( k, v.manage_FTPget() )
+
+        archive.close()
+        return stream.getvalue()
+
+
+    security.declarePrivate('_getZipFile_recurse')
+    def _getZipFile_recurse(self, archive, prefix=''):
+        """ Recursively add files to the archive.
+        """
         archive.writestr( 'index.html'
                         , self.index_html( suite_name='testSuite.html' ) )
 
-        test_cases = [ { 'id' :  self._getFilename( k )
-                       , 'title' : v.title_or_id()
-                       , 'data' : v.manage_FTPget()
-                       } for ( k, v ) in self.objectItems( [ 'File'
-                                                           , 'Page Template'
-                                                           ] ) ]
+        test_cases = []
+
+        for ( k, v ) in self.objectItems( self.test_case_metatypes ):
+            id =  self._getFilename( k )
+            path = prefix and '%s/%s' % ( prefix, id ) or id
+
+            test_cases.append( { 'id' :  id
+                               , 'title' : v.title_or_id()
+                               , 'url' : path
+                               , 'path' : path
+                               , 'data' : v.manage_FTPget()
+                               } )
 
         archive.writestr( 'testSuite.html'
                         , self.test_suite_html( test_cases=test_cases ) )
 
-        for k, v in _SUPPORT_FILES.items():
-            archive.writestr( k, v.manage_FTPget() )
-
         for test_case in test_cases:
-            archive.writestr( test_case[ 'id' ]
+            archive.writestr( test_case[ 'path' ]
                             , test_case[ 'data' ] )
 
-        archive.close()
-        return stream.getvalue()
-
+        for subsuite_id, subsuite in self.objectItems( self.meta_type ):
+            subsuite._getZipFile_recurse( archive
+                                        , prefix='%s/%s' % ( prefix 
+                                                           , subsuite_id )
+                                        )
 
 InitializeClass(Zuite)
 

_______________________________________________
Zope-CVS maillist  -  [email protected]
http://mail.zope.org/mailman/listinfo/zope-cvs

Zope CVS instructions: http://dev.zope.org/CVS
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.