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

Sidnei da Silva sidnei at x3ng.com.br
Tue Apr 1 11:48:28 EST 2003


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

Modified Files:
	NZOMigrate.py setupZopeOrg.py 
Log Message:
Commit a few changes that were laying for a long time in my box.

=== Products/ZopeOrg-NV/Extensions/NZOMigrate.py 1.19 => 1.20 ===
                     "Broken Because Product is Gone": "BBR",
                     "XML Document": "Parsed XML",
                     "BackTalk Book": "CMF BackTalk Book",
-                    "BackTalk Document": "CMF BackTalk Document"
+                    "BackTalk Document": "CMF BackTalk Document",
+                    "External Method": "Unsafe"
                     }
 
         if exceptions is None:
@@ -72,8 +73,8 @@
     kw['kibitzers'] = issue.issueOwners()
     kw['submitter_id'] = issue.requester
     kw['modification_date'] = issue.date.ISO()
-    kw['title'] = issue.title
-    kw['description'] = issue.description
+    kw['description'] = getattr(aq_base(issue), 'description', '')
+    kw['title'] = getattr(aq_base(issue), 'title', '') or (kw['description'][:50] + '...')
     kw['version_info'] = ''
     kw['action_number'] = len(issue.keys()) -1 
     items = issue.items()
@@ -314,7 +315,9 @@
     return ''.join(format_exception(t, e, tb, as_html=0))
 
 def setLocalRoles(self, ids, role, obj_url):
-    pm = getToolByName(self, 'portal_membership')
+    pm = getToolByName(self, 'portal_membership', None)
+    if pm is None:
+        return
     try:
         __traceback_info__ = ('setLocalRoles', obj_url, ids, role)
         pm.setLocalRoles( self
@@ -348,7 +351,9 @@
     """ Allow workflows to update the role-permission mappings.
     """
     wfs = {}
-    wf_tool = getToolByName(obj, 'portal_workflow')
+    wf_tool = getToolByName(obj, 'portal_workflow', None)
+    if wf_tool is None:
+        return 0
     for id in wf_tool.objectIds():
         wf = wf_tool.getWorkflowById(id)
         if hasattr(aq_base(wf), 'updateRoleMappingsFor'):
@@ -357,7 +362,7 @@
     #log('updateRoleMappings: %d object(s) updated.\n' % count)
     return count
 
-def massPublish(obj):
+def massPublish(obj, recurse=0):
     if obj is None:
         return
     wf_tool = getToolByName(obj, 'portal_workflow', None)
@@ -369,13 +374,15 @@
         #log('Published %s.\n' % obj.getId())
     except: pass
     get_transaction().commit()
+    if not recurse:
+        return
     if hasattr(obj, 'objectValues'):
         for subob in obj.objectValues():
-            massPublish(subob)
+            massPublish(subob, recurse)
     elif hasattr(obj, 'keys'):
         for id in obj.keys():
             try:
-                massPublish(obj[id])
+                massPublish(obj[id], recurse)
             except (KeyError, AttributeError): 
                 log(pretty_exc(sys.exc_info()))
                 pass
@@ -655,6 +662,10 @@
         self.log('Ignoring Broken Beyond Repair.\n')
         return None
 
+    def ExternalMethod2Unsafe(self, obj, source, dest):
+        self.log('Ignoring External Methods because they are Unsafe.\n')
+        return None
+
     def ZWikiPage2ZWikiPage(self, obj, source, dest):
         obj = self.defaultMigrationMethod(obj, source, dest)
         return obj
@@ -1055,16 +1066,29 @@
                         self.log('Invalid object found when migrating: %s.\n' % obj_url)
                         continue
 
-                    new_obj = fixOwnership(obj, new_obj)
-                    new_obj = copyProperties(obj, new_obj)
+                    try:
+                        new_obj = fixOwnership(obj, new_obj)
+                    except:
+                        self.log(pretty_exc(sys.exc_info()))
+
+                    try:
+                        new_obj = copyProperties(obj, new_obj)
+                    except:
+                        self.log(pretty_exc(sys.exc_info()))
+
                     res = []
-                    res = _cleanupOwnership(new_obj, res, 0)
-                    if res != []:
-                        self.log('\n'.join(res) + '\n')
-                    
-                    massPublish(new_obj)
-                    updateRoleMappings(new_obj)
-                    
+                    try:
+                        res = _cleanupOwnership(new_obj, res, 0)
+                        if res != []:
+                            self.log('\n'.join(res) + '\n')
+                    except:
+                        self.log(pretty_exc(sys.exc_info()))
+
+                    try:
+                        massPublish(new_obj, 0)
+                    except:
+                        self.log(pretty_exc(sys.exc_info()))
+
                     if hasattr(obj, 'objectIds') and new_obj is not None:
                         ignore = WikiMethodsCleanup(obj, obj_url, ignore)
                         ignore = DefaultDTMLCleanup(obj, obj_url, ignore)
@@ -1077,7 +1101,10 @@
                             res = recursiveOwnerFix(new_obj, oid, 1)
                             setLocalRoles(new_obj, (oid, ), 'Owner', obj_url)
 
-                    new_obj = fixModificationDate(obj, new_obj)
+                    try:
+                        new_obj = fixModificationDate(obj, new_obj)
+                    except:
+                        self.log(pretty_exc(sys.exc_info()))
 
                     ct = getToolByName(new_obj, 'portal_catalog', None)
                     if ct is not None:


=== Products/ZopeOrg-NV/Extensions/setupZopeOrg.py 1.65 => 1.66 ===
                 }
               , { 'id' : 'ZO_setupZWiki'
                 , 'title' : 'Set up ZWiki product'
-                , 'module' : 'ZWiki.cmf_install_zwiki'
+                , 'module' : 'ZWiki.Install'
                 , 'function' : 'install'
                 }
               , { 'id' : 'ZO_setupCMFPackage'





More information about the zopeorg-checkins mailing list