[zopeorg-checkins] CVS: Products/ZopeOrg-NV/Extensions - NZOMigrate.py:1.2 setupZopeOrg.py:1.60

Sidnei da Silva sidnei at x3ng.com.br
Wed Dec 4 13:13:02 EST 2002


Update of /cvs-zopeorg/Products/ZopeOrg-NV/Extensions
In directory cvs.zope.org:/tmp/cvs-serv29026/Extensions

Modified Files:
	NZOMigrate.py setupZopeOrg.py 
Log Message:
Updated Migration to use CMFPackage. Needs testing.

=== Products/ZopeOrg-NV/Extensions/NZOMigrate.py 1.1 => 1.2 ===
         return None
 
     def SoftwareProduct2CMFSoftwarePackage(self, obj, source, dest):
-        self.log('Ignoring Software Product for now.\n')
-        return None
+        dest.invokeFactory(id=obj.getId(), type_name='Software Package')
+        f = getattr(dest, obj.getId())
+        title = obj.title or ''
+        description = obj.description or ''
+        subject = obj.Software_topics or []
+        contact_email = obj.contact_email
+        f.setTitle(title)
+        f.setDescription(description)
+        f.setSubject(subject)
+        f.setContactEmail(contact_email)
+        return f
 
     def ProductRelease2CMFSoftwareRelease(self, obj, source, dest):
-        self.log('Ignoring Product Release for now.\n')
-        return None
+        dest.invokeFactory(id=obj.getId(), type_name='Software Release')
+        f = getattr(dest, obj.getId())
+        title = obj.title or ''
+        version = obj.version
+        f.setTitle(title)
+        f.setVersion(version)
+
+        f.invokeFactory(id=obj.getId(), type_name='Software Release File')
+        r = getattr(dest, obj.getId())
+        platform = obj.platform
+        maturity = obj.status
+        info_url = obj.info_url
+        license_url = obj.license_url
+        changes_url = obj.changes_url
+        installation_url = obj.installation_url
+        license = obj.license
+        data, size = f._read_data(obj.data)
+        
+        r.update_data(data, content_type, size)
+        r.setPlatform(platform)
+        r.setMaturity(maturity)
+        r.setInfoURL(info_url)
+        r.setLicenseURL(license_url)
+        r.setChangesURL(changes_url)
+        r.setInstallationURL(installation_url)
+        r.setLicense(license)
+
+        return f
 
     def Tracker2CMFCollector(self, obj, source, dest):
         self.log('Ignoring Tracker for now.\n')


=== Products/ZopeOrg-NV/Extensions/setupZopeOrg.py 1.59 => 1.60 ===
 
 from Products.PluginIndexes.FieldIndex.FieldIndex import FieldIndex
 from Products.PluginIndexes.DateIndex.DateIndex import DateIndex
+from Products.PluginIndexes.DateRangeIndex.DateRangeIndex import DateRangeIndex
 
 from Products.CMFDateIndexes.RSCatalogTool import RSCatalogTool
 from Products.BTreeFolder2.CMFBTreeFolder import manage_addCMFBTreeFolder
@@ -38,6 +39,7 @@
                   , 'CMFCore'
                   , 'CMFCalendar'
                   , 'ZWiki'
+                  , 'CMFPackage'
                   , 'BackTalk'
                   , 'CMFBackTalk'
                   , 'DCWorkflow'
@@ -85,6 +87,11 @@
                 , 'module' : 'ZWiki.cmf_install_zwiki'
                 , 'function' : 'install'
                 }
+              , { 'id' : 'ZO_setupCMFPackage'
+                , 'title' : 'Set up CMFPackage product'
+                , 'module' : 'CMFPackage.Install'
+                , 'function' : 'install'
+                }
               , { 'id' : 'ZO_NZOMigrate'
                 , 'title' : 'Migrate script for NZO'
                 , 'module' : 'ZopeOrg.NZOMigrate'
@@ -233,23 +240,6 @@
     #    if string.find( log_line, '   ' ) != -1:
     #        log.append( log_line )
 
-    # Prune the addable types visible in CMF Folders
-    log.append( '\n * Pruning addable types in folder add list' )
-    types_tool = getattr( portal, 'portal_types' )
-    folder_type = getattr( types_tool, 'Folder' )
-    all_types = types_tool.objectIds()
-
-    for type in INVISIBLE_TYPES:
-        if type in all_types:
-            del all_types[all_types.index( type )]
-            log.append( '   - removed type "%s"' % type )
-
-    folder_type._updateProperty( id='filter_content_types'
-                                , value=0
-                                )
-    folder_type._updateProperty( id='allowed_content_types'
-                               , value=all_types
-                               )
 
     # Create all the extra directories we need
     #log.append('\n * Creating default folder structure')
@@ -268,6 +258,14 @@
         log_list[i] = '   - %s' % log_list[i]
     log.extend( log_list )
 
+    # Run the CMFPackage install script
+    log.append( '\n * Executing the CMFPackage install script' )
+    log_str = portal.ZO_setupCMFPackage()
+    log_list = string.split( log_str, '\n' )
+    for i in range( len( log_list ) ):
+        log_list[i] = '   - %s' % log_list[i]
+    log.extend( log_list )
+
     # Run the CMFCalendar install script
     log.append('\n * Executing CMFCalendar install script')
     log_str = portal.installCMFCalendar()
@@ -285,10 +283,42 @@
     log.extend(log_list)
 
     log.append('\n * Modifying allowed/filtered types for folderish types')
-    folderish_types=['Wiki Folder', 'Software Product',
+    folderish_types=['Wiki Folder', 'Software Package',
                      'Software Release', 'Member Folder']
     setupAllowedTypes(portal, folderish_types)
 
+    # Prune the addable types visible in CMF Folders
+    log.append( '\n * Pruning addable types in folder add list' )
+    types_tool = getattr( portal, 'portal_types' )
+    folder_type = getattr( types_tool, 'Folder' )
+    all_types = types_tool.objectIds()
+
+    for type in INVISIBLE_TYPES:
+        if type in all_types:
+            invisible_type = getattr( types_tool, type )
+            invisible_type._updateProperty( id='global_allow'
+                                             , value=0
+                                             )
+            del all_types[all_types.index( type )]
+            log.append( '   - removed type "%s"' % type )
+
+    folder_type._updateProperty( id='filter_content_types'
+                                , value=0
+                                )
+    folder_type._updateProperty( id='allowed_content_types'
+                               , value=all_types
+                               )
+
+    # The same to Wiki Folder if present.
+    if 'Wiki Folder' in all_types:
+        wf_type = getattr( types_tool, 'Wiki Folder' )
+        wf_type._updateProperty( id='filter_content_types'
+                                     , value=0
+                                     )
+        wf_type._updateProperty( id='allowed_content_types'
+                                     , value=all_types
+                                     )
+
     # The roster shit is dangerous. we remove it here.
     mem_folder = getattr( portal, 'Members' )
     if 'index_html' in mem_folder.objectIds():
@@ -697,7 +727,7 @@
      """
      tt = getToolByName(portal, 'portal_types')
      typesList = tt.listTypeInfo()
-     pdTypes = ['Document', 'Favorite', 'Link', 'News Item', 'File', 'Tip', 'HowTo', 'Software Product', 'Software Release', 'Software Release File']
+     pdTypes = ['Document', 'Favorite', 'Link', 'News Item', 'File', 'Tip', 'HowTo', 'Software Package', 'Software Release', 'Software Release File']
      for i in typesList:
         new_actions = []
         for dict in i._actions:





More information about the zopeorg-checkins mailing list