[zopeorg-checkins] CVS: Products/ZopeOrg-NV/Extensions - NZOMigrate.py:1.24

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


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

Modified Files:
	NZOMigrate.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/Extensions/NZOMigrate.py 1.23 => 1.24 ===
 from StringIO import StringIO
 from ZODB.POSException import POSKeyError
 from Acquisition import aq_base, aq_parent, aq_inner
+from Products.CMFCore.WorkflowCore import WorkflowException
 from Products.CMFCore.utils import getToolByName
 from Products.CMFCollector.CollectorIssue import CollectorIssue
 from DateTime import DateTime
@@ -141,11 +142,19 @@
         if action != 'request' and action not in issue._valid_actions():
             raise 'Unauthorized', "Invalid action '%s'" % action
 
-        issue.portal_workflow.doActionFor(issue,
-                                          action,
-                                          comment=comment,
-                                          username=username,
-                                          assignees=assignees)
+        try:
+            issue.portal_workflow.doActionFor(issue,
+                                              action,
+                                              comment=comment,
+                                              username=username,
+                                              assignees=assignees)
+        except WorkflowException:
+            action = 'new_issue'
+            issue.portal_workflow.doActionFor(issue,
+                                              action,
+                                              comment=comment,
+                                              username=username,
+                                              assignees=assignees)
 
     new_status = issue.status().split('_')[0]
 
@@ -208,7 +217,7 @@
     comment = '(Supporters added by migration tool)'
     action = 'assign'
     date = DateTime()
-    
+
     issue.portal_workflow.doActionFor(issue,
                                       action,
                                       comment=comment,
@@ -812,6 +821,7 @@
                                             'application/octet-stream')
 
         r.update_data(data, content_type, size)
+        r.manage_upload(data)
         r._calculateMD5()
         r.setPlatform(platform)
         f.setMaturity(maturity)
@@ -852,7 +862,7 @@
             transcript = new_issue.get_transcript()
             transcript.edit(new_issue.TRANSCRIPT_FORMAT,
                             text)
-            doIssueAssign(new_issue, 
+            doIssueAssign(new_issue,
                           assignees=kw['assignees'])
             doIssueAction(new_issue, action=kw['resolution'],
                           comment=getattr(last_issue, 'description'),
@@ -865,9 +875,13 @@
                                         att['title'], att['data'])
             result.append(new_issue)
             get_transaction().commit()
+            issue._p_deactivate()
+            new_issue._p_deactivate()
             self.log('Migrated Issue %s.\n' % kw['id'])
 
         CollectorIssue._send_update_notice = CollectorIssue._old_send_update_notice
+        collector._setPropValue('last_issue_id', int(kw['id']))
+        collector._p_deactivate()
         return tuple(result)
 
 
@@ -1199,9 +1213,11 @@
 
                     if self._count % 100:
                         get_transaction().commit()
-                    elif self._count % 50:
+                    elif self._count % 20:
                         get_transaction().commit(1)
+                    new_obj._p_deactivate()
 
+                obj._p_deactivate()
                 self.log('%s: Success.\n' % obj_url)
 
         return 'Ok.\n'





More information about the zopeorg-checkins mailing list