[zopeorg-checkins] CVS: Products/ZopeOrg-NV - Installer.py:1.3 __init__.py:1.23

Sidnei da Silva sidnei at x3ng.com.br
Fri May 30 17:14:06 EDT 2003


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

Modified Files:
	Installer.py __init__.py 
Log Message:
Fixing some bits on the installer. Enabling CMFContentList, disabling CMFDateIndexes, hotfixing DublinCore (Overflow!), added QueueCatalog. Fixing some bits on the migration. Try to deactivate objects as much as possible, and lower the subtransaction interval (weve got some BIG objects here eh)

=== Products/ZopeOrg-NV/Installer.py 1.2 => 1.3 ===
 import os, string
 from StringIO import StringIO
+from Acquisition import aq_base
 
 from Products.CMFPlone.Portal import addPolicy
 from Products.CMFPlone.CustomizationPolicy import DefaultCustomizationPolicy
@@ -15,10 +16,12 @@
 from Products.ZCTextIndex import ZCTextIndex
 from Products.PluginIndexes.DateIndex.DateIndex import DateIndex
 from Products.PluginIndexes.DateRangeIndex.DateRangeIndex import DateRangeIndex
-from Products.CMFDateIndexes.RSCatalogTool import RSCatalogTool
 
 from Products.ExternalMethod.ExternalMethod import ExternalMethod
 
+from Products.QueueCatalog import QueueCatalog
+
+
 def register(context, app_state):
     addPolicy('Zope.org Policy', ZopeOrgPolicy())
 
@@ -30,8 +33,8 @@
 NEEDED_PRODUCTS = ( 'CMFDefault'
                   , 'CMFCore'
                   , 'CMFCalendar'
-                  , 'CMFDateIndexes'
                   , 'CMFCollector'
+                  , 'CMFContentList'
                   , 'ZWiki'
                   , 'CMFPackage'
                   , 'BackTalk'
@@ -44,10 +47,12 @@
                   , 'CMFPlone'
                   , 'Formulator'
                   , 'ExternalEditor'
+                  , 'QueueCatalog'
+                  , 'ZopeProfiler'
                   )
 
 SKINPATHS = ( 'Basic',
-              'NZO', 
+              'NZO',
               'Plone Core',
               'Plone Default',
               'Plone Autumn',
@@ -78,7 +83,7 @@
 ZCTEXTINDEXES = ( 'Description', 'SearchableText', 'Title' )
 
 WORKFLOWS = (('default', 'zopeorg_default_workflow',
-              'Default Zope.org Workflow'), 
+              'Default Zope.org Workflow'),
             )
 
 EXT_METHODS = ( { 'id' : 'ZO_NZOMigrate'
@@ -90,7 +95,7 @@
                 , 'title' : 'Synchronize ZODB and filesystem skeleton'
                 , 'module' : 'ZopeOrg.synchronizeSkeleton'
                 , 'function' : 'synchronize'
-                }             
+                }
               )
 
 PRODUCTS_SETUP = ({'id' : 'ZWiki'
@@ -109,6 +114,10 @@
                       , 'module': 'CMFCollector.Extensions.Install'
                       , 'function' : 'install'
                       }
+                  , { 'id' : 'CMFContentList'
+                      , 'module': 'CMFContentList.Extensions.Install'
+                      , 'function' : 'install'
+                      }
                   )
 
 SEPARATOR = '\n' + '='*65 + '\n'
@@ -120,7 +129,7 @@
 
 class ZopeOrgPolicy(DefaultCustomizationPolicy):
     """ Zope.org Initialization """
-    
+
     __implements__ = ICustomizationPolicy
 
     def __init__(self):
@@ -128,7 +137,7 @@
 
     def log(self, msg):
         self.out.write(msg + SEPARATOR)
-        
+
     def customize(self, portal):
         DefaultCustomizationPolicy().customize(portal)
         self.log('Checking dependencies....')
@@ -146,6 +155,9 @@
         self.log('Configuring Actions....')
         self.setupActions(portal)
 
+        self.log('Fixing Collector Actions....')
+        self.setupCollectorActions(portal)
+
         self.log('Configuring Slots....')
         self.setupDefaultSlots(portal)
 
@@ -158,7 +170,7 @@
         self.log('Setting up new skins....')
         self.registerSkins(portal)
 
-        self.log('Replacing Portal Catalog Tool with Date Range version....')
+        self.log('Replacing Portal Catalog Tool with QueueCatalog....')
         self.replaceCatalogTool(portal)
 
         self.log('Modifying Catalog Indexes and Metadata....')
@@ -167,13 +179,13 @@
         self.catalogReplaceIndexes(portal)
         self.catalogAddColumns(portal)
         self.catalogAddZCTextIndexes(portal)
-        
+
         self.log('Instantiating type objects in the Types tool...')
         self.setupTypes( portal )
 
         self.log('Enabling Discussions....')
         self.setupDiscussions(portal)
-    
+
         self.log('Instantiating MetaData Policies in the MetaData tool....')
         self.setupMetaData(portal)
 
@@ -185,7 +197,7 @@
 
         self.log('Finished conversion process!')
         return self.out.getvalue()
-    
+
     def setupProducts(self, portal):
         for p in PRODUCTS_SETUP:
             d = {}
@@ -220,7 +232,7 @@
         import Products
         not_installed = []
         installed_products = dir( Products )
-        
+
         for prod_name in NEEDED_PRODUCTS:
             if prod_name not in installed_products:
                 not_installed.append(prod_name)
@@ -230,7 +242,7 @@
 
     def registerWorkflows(self, portal):
         """ Insert new zope.org workflows into the workflow tool """
-        
+
         for wf_tuple in WORKFLOWS:
             wf_portaltype = wf_tuple[0]
             wf_id = wf_tuple[1]
@@ -247,7 +259,7 @@
                 wf_tool.setChainForPortalTypes( (wf_portaltype,)
                                               , wf_id
                                               )
-                self.log(' - Inserted workflow "%s" for type "%s"' % (wf_id, 
+                self.log(' - Inserted workflow "%s" for type "%s"' % (wf_id,
                                                                       wf_portaltype))
             wf_tool.updateRoleMappings()
 
@@ -379,31 +391,49 @@
                                          )
             self.log('Set allowed types for BTree Folder to: %s' % all_types)
 
+    def setupCollectorActions(self, portal):
+        types_tool = getattr( portal, 'portal_types' )
+        all_types = types_tool.objectIds()
+        fixed = []
+
+        for type in all_types:
+            if type.find('Collector') >= 0:
+                fixed.append(type)
+                t = getattr(types_tool, type)
+                ptype_actions=t._cloneActions()
+                for action in ptype_actions:
+                    if action['action'].find('string:${object_url}/') == 0:
+                        action['action'] = action['action'][21:]
+                t._actions=tuple(ptype_actions)
+
+        self.log('Fixed actions for : %s' % fixed)
+
     def replaceCatalogTool(self, portal):
         """Replace the catalog tool if necessary"""
         p_cat = getattr(portal, 'portal_catalog')
 
-        if isinstance(p_cat, RSCatalogTool):
-            self.log(' - Portal Catalog tool already an RSCatalogTool')
+        if isinstance(p_cat, QueueCatalog):
+            self.log(' - Portal Catalog tool already a QueueCatalog')
             return
 
-        new_cat = RSCatalogTool()
+        new_cat = QueueCatalog()
         new_cat.__dict__.update(p_cat.__dict__)
+        new_cat.manage_edit('', location='portal_catalog_real', immediate_removal=1)
         new_cat._p_changed = 1
 
         setattr(portal, 'portal_catalog', new_cat)
+        portal._setObject('portal_catalog_real', aq_base(p_cat))
         objmap = portal._objects
         for info in objmap:
             if info['id'] == 'portal_catalog':
                 info['meta_type'] = new_cat.meta_type
         portal._objects = objmap
 
-        self.log(' - Replaced Portal Catalog tool with RSCatalogTool')
-
+        self.log(' - Replaced Portal Catalog tool with QueueCatalog')
 
     def catalogAddIndexes(self, portal):
         """ Add Indexes to the portal catalog """
-        p_cat = getattr(portal, 'portal_catalog')
+        p_cat = getattr(portal, 'portal_catalog_real')
         cat_core = p_cat._catalog
         retained = []
         added = []
@@ -429,7 +459,7 @@
 
     def catalogAddZCTextIndexes(self, portal):
         """ Add ZCTextIndexes to the portal catalog """
-        p_cat = getattr(portal, 'portal_catalog')
+        p_cat = getattr(portal, 'portal_catalog_real')
         cat_core = p_cat._catalog
         replaced = []
         added = []
@@ -479,7 +509,7 @@
 
     def catalogReplaceIndexes(self, portal):
         """ Replace indexes in the portal catalog """
-        p_cat = getattr(portal, 'portal_catalog')
+        p_cat = getattr(portal, 'portal_catalog_real')
         cat_core = p_cat._catalog
         retained = []
         replaced = []
@@ -506,7 +536,7 @@
 
     def catalogAddColumns(self, portal):
         """ Add metadata colums to the portal catalog """
-        p_cat = getattr(portal, 'portal_catalog')
+        p_cat = getattr(portal, 'portal_catalog_real')
         cat_core = p_cat._catalog
         added = []
         retained = []
@@ -527,7 +557,7 @@
 
     def catalogAddEffectiveRange(self, portal):
         """ Add the effectiveRange DateRangeIndex index """
-        p_cat = getattr(portal, 'portal_catalog')
+        p_cat = getattr(portal, 'portal_catalog_real')
         cat_core = p_cat._catalog
 
         if cat_core.indexes.has_key('effectiveRange'):
@@ -546,7 +576,7 @@
         contentTypes = ['Document', 'File', 'HowTo', 'Link', 'News Item', 'Tip']
         for i in contentTypes:
             if i in tt.objectIds():
-                ob = tt._getOb(i) 
+                ob = tt._getOb(i)
                 ob.allow_discussion = 1
             self.log(' - Enabling Discussion on "%s"' % i)
 
@@ -560,7 +590,7 @@
             if type in prePolicies:
                 mt.removeElementPolicy(element='Subject', content_type='%s' % type)
                 self.log(' - Existing %s MetaData Policy removed' % type)
-                
+
         mt.addElementPolicy(element='Subject'
                           , content_type='Link'
                           , is_required=0


=== Products/ZopeOrg-NV/__init__.py 1.22 => 1.23 ===
+from string import rfind
+from DateTime.DateTime import DateTime
+
 from Products.CMFCore.DirectoryView import registerDirectory
 from Products.CMFCore.utils import registerIcon, ToolInit, ContentInit
 from Products.CMFCore.CMFCorePermissions import AddPortalContent
@@ -9,11 +12,14 @@
 import ZopeServiceProvider
 import ZopeOrgTypes
 import ZPublisher.Publish
-from string import rfind
 
 #Hackish workaround to allow accesing the broken ZODB on ZopeOrg
 class ImplicitAcquirerWrapper:
     pass
+
+from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl
+DefaultDublinCoreImpl._DefaultDublinCoreImpl__FLOOR_DATE   = DateTime(1979, 0)
+DefaultDublinCoreImpl._DefaultDublinCoreImpl__CEILING_DATE = DateTime(2979, 0)
 
 Acquisition.ImplicitAcquirerWrapper = ImplicitAcquirerWrapper
 ZPublisher.Publish.rfind = rfind





More information about the zopeorg-checkins mailing list