[Erp5-report] r27896 - in /erp5/trunk: bt5/erp5_dms/PortalTypeWorkflowChainTemplateItem/ bt...

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jul 3 11:21:34 CEST 2009


Author: jm
Date: Fri Jul  3 11:21:31 2009
New Revision: 27896

URL: http://svn.erp5.org?rev=27896&view=rev
Log:
Fix document ingestion so that no workflow method is called when the transition doesn't exist for the current state.
This is mainly done by removing 'edit' transition on processing_workflow, to prevent duplicate processing of ingestion.
Reuse edit_workflow for all portal types with processing_status_workflow and update computation of revision (Document.getRevision).

Removed:
    erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/transitions/edit.xml
    erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/transitions/edit.xml
Modified:
    erp5/trunk/bt5/erp5_dms/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
    erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_interaction_workflow/scripts/upload.xml
    erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/states/draft.xml
    erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/states/embedded.xml
    erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/converted.xml
    erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/converting.xml
    erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/empty.xml
    erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/uploaded.xml
    erp5/trunk/bt5/erp5_dms/bt/change_log
    erp5/trunk/bt5/erp5_dms/bt/revision
    erp5/trunk/bt5/erp5_dms/bt/template_portal_type_workflow_chain_list
    erp5/trunk/products/ERP5/Document/Document.py
    erp5/trunk/products/ERP5/Tool/ContributionTool.py
    erp5/trunk/products/ERP5OOo/tests/testDms.py
    erp5/trunk/products/ERP5OOo/tests/testIngestion.py

Modified: erp5/trunk/bt5/erp5_dms/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml?rev=27896&r1=27895&r2=27896&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_dms/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_dms/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml [utf8] Fri Jul  3 11:21:31 2009
@@ -5,19 +5,19 @@
  </chain>
  <chain>
   <type>Drawing</type>
-  <workflow>local_permission_interaction_workflow, processing_status_workflow, document_interaction_workflow, document_publication_workflow</workflow>
+  <workflow>local_permission_interaction_workflow, edit_workflow, processing_status_workflow, document_interaction_workflow, document_publication_workflow</workflow>
  </chain>
  <chain>
   <type>File</type>
-  <workflow>-edit_workflow, document_publication_workflow, document_interaction_workflow, local_permission_interaction_workflow, processing_status_workflow</workflow>
+  <workflow>document_publication_workflow, document_interaction_workflow, local_permission_interaction_workflow, processing_status_workflow</workflow>
  </chain>
  <chain>
   <type>Image</type>
-  <workflow>-edit_workflow, document_interaction_workflow, document_publication_workflow, processing_status_workflow, local_permission_interaction_workflow</workflow>
+  <workflow>document_interaction_workflow, document_publication_workflow, processing_status_workflow, local_permission_interaction_workflow</workflow>
  </chain>
  <chain>
   <type>PDF</type>
-  <workflow>local_permission_interaction_workflow, processing_status_workflow, document_interaction_workflow, document_publication_workflow</workflow>
+  <workflow>local_permission_interaction_workflow, edit_workflow, processing_status_workflow, document_interaction_workflow, document_publication_workflow</workflow>
  </chain>
  <chain>
   <type>Person</type>
@@ -25,7 +25,7 @@
  </chain>
  <chain>
   <type>Presentation</type>
-  <workflow>document_publication_workflow, local_permission_interaction_workflow, processing_status_workflow, document_interaction_workflow</workflow>
+  <workflow>document_publication_workflow, local_permission_interaction_workflow, processing_status_workflow, document_interaction_workflow, edit_workflow</workflow>
  </chain>
  <chain>
   <type>RSS Feed</type>
@@ -33,11 +33,11 @@
  </chain>
  <chain>
   <type>Spreadsheet</type>
-  <workflow>document_interaction_workflow, processing_status_workflow, document_publication_workflow, local_permission_interaction_workflow</workflow>
+  <workflow>edit_workflow, document_interaction_workflow, processing_status_workflow, document_publication_workflow, local_permission_interaction_workflow</workflow>
  </chain>
  <chain>
   <type>Text</type>
-  <workflow>processing_status_workflow, local_permission_interaction_workflow, document_publication_workflow, document_interaction_workflow</workflow>
+  <workflow>processing_status_workflow, local_permission_interaction_workflow, document_publication_workflow, edit_workflow, document_interaction_workflow</workflow>
  </chain>
  <chain>
   <type>URL Crawler</type>

Modified: erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_interaction_workflow/scripts/upload.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_interaction_workflow/scripts/upload.xml?rev=27896&r1=27895&r2=27896&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_interaction_workflow/scripts/upload.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_interaction_workflow/scripts/upload.xml [utf8] Fri Jul  3 11:21:31 2009
@@ -53,15 +53,16 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>object = state_change[\'object\']\n
-object.uploadFile()\n
+            <value> <string>document = state_change[\'object\']\n
+document.uploadFile()\n
 \n
 # do not activate conversion if the object is in portal_contributions\n
 # because it will be gone from there in a second\n
 # and activate would fail\n
-if object.getParentValue().getPortalType() != \'Contribution Tool\':\n
-  object.processFile()\n
-  object.activate().Document_tryToConvertToBaseFormat()\n
+if document.getParentValue().getPortalType() != \'Contribution Tool\' \\\n
+   and document.isSupportBaseDataConversion():\n
+  document.processFile()\n
+  document.activate().Document_tryToConvertToBaseFormat()\n
 </string> </value>
         </item>
         <item>
@@ -100,7 +101,7 @@
                           <tuple>
                             <string>state_change</string>
                             <string>_getitem_</string>
-                            <string>object</string>
+                            <string>document</string>
                             <string>_getattr_</string>
                           </tuple>
                         </value>

Modified: erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/states/draft.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/states/draft.xml?rev=27896&r1=27895&r2=27896&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/states/draft.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/states/draft.xml [utf8] Fri Jul  3 11:21:31 2009
@@ -35,7 +35,6 @@
                 <string>cancel_action</string>
                 <string>delete</string>
                 <string>delete_action</string>
-                <string>edit</string>
                 <string>embed</string>
                 <string>publish</string>
                 <string>publish_action</string>

Modified: erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/states/embedded.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/states/embedded.xml?rev=27896&r1=27895&r2=27896&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/states/embedded.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/states/embedded.xml [utf8] Fri Jul  3 11:21:31 2009
@@ -31,7 +31,6 @@
             <key> <string>transitions</string> </key>
             <value>
               <tuple>
-                <string>edit</string>
                 <string>extract</string>
               </tuple>
             </value>

Removed: erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/transitions/edit.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/transitions/edit.xml?rev=27895&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/transitions/edit.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/document_publication_workflow/transitions/edit.xml (removed)
@@ -1,61 +1,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <tuple>
-        <global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>actbox_category</string> </key>
-            <value> <string>workflow</string> </value>
-        </item>
-        <item>
-            <key> <string>actbox_name</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>actbox_url</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>after_script_name</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>description</string> </key>
-            <value> <string>The edit workflow method is trigerred each time a document is modified. It is necessary so that the embed automatic script can be invoked (XXX - double check this)</string> </value>
-        </item>
-        <item>
-            <key> <string>guard</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>edit</string> </value>
-        </item>
-        <item>
-            <key> <string>new_state_id</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>script_name</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string>Edit</string> </value>
-        </item>
-        <item>
-            <key> <string>trigger_type</string> </key>
-            <value> <int>2</int> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>

Modified: erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/converted.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/converted.xml?rev=27896&r1=27895&r2=27896&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/converted.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/converted.xml [utf8] Fri Jul  3 11:21:31 2009
@@ -25,7 +25,6 @@
             <key> <string>transitions</string> </key>
             <value>
               <tuple>
-                <string>edit</string>
                 <string>update_file_metadata</string>
                 <string>upload_file</string>
               </tuple>

Modified: erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/converting.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/converting.xml?rev=27896&r1=27895&r2=27896&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/converting.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/converting.xml [utf8] Fri Jul  3 11:21:31 2009
@@ -27,7 +27,6 @@
               <tuple>
                 <string>convert_action</string>
                 <string>convert_file</string>
-                <string>edit</string>
                 <string>process_file</string>
                 <string>upload_file</string>
               </tuple>

Modified: erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/empty.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/empty.xml?rev=27896&r1=27895&r2=27896&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/empty.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/empty.xml [utf8] Fri Jul  3 11:21:31 2009
@@ -26,7 +26,6 @@
             <value>
               <tuple>
                 <string>detect_uploaded_file</string>
-                <string>edit</string>
                 <string>upload_file</string>
               </tuple>
             </value>

Modified: erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/uploaded.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/uploaded.xml?rev=27896&r1=27895&r2=27896&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/uploaded.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/states/uploaded.xml [utf8] Fri Jul  3 11:21:31 2009
@@ -27,7 +27,6 @@
               <tuple>
                 <string>convert_action</string>
                 <string>detect_converted_file</string>
-                <string>edit</string>
                 <string>process_file</string>
                 <string>upload_file</string>
               </tuple>

Removed: erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/transitions/edit.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/transitions/edit.xml?rev=27895&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/transitions/edit.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/processing_status_workflow/transitions/edit.xml (removed)
@@ -1,61 +1,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <tuple>
-        <global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>actbox_category</string> </key>
-            <value> <string>workflow</string> </value>
-        </item>
-        <item>
-            <key> <string>actbox_name</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>actbox_url</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>after_script_name</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>description</string> </key>
-            <value> <string>action called when editing a document</string> </value>
-        </item>
-        <item>
-            <key> <string>guard</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>edit</string> </value>
-        </item>
-        <item>
-            <key> <string>new_state_id</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>script_name</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string>Edit</string> </value>
-        </item>
-        <item>
-            <key> <string>trigger_type</string> </key>
-            <value> <int>2</int> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>

Modified: erp5/trunk/bt5/erp5_dms/bt/change_log
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/bt/change_log?rev=27896&r1=27895&r2=27896&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_dms/bt/change_log [utf8] (original)
+++ erp5/trunk/bt5/erp5_dms/bt/change_log [utf8] Fri Jul  3 11:21:31 2009
@@ -1,3 +1,6 @@
+2009-07-03 jm
+* Remove 'edit' transition on processing_status_workflow and reuse edit_workflow.
+
 2009-05-15 yusei
 * Add my_editor_field to Base_viewDMSFieldLibrary.
 

Modified: erp5/trunk/bt5/erp5_dms/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/bt/revision?rev=27896&r1=27895&r2=27896&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_dms/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_dms/bt/revision [utf8] Fri Jul  3 11:21:31 2009
@@ -1,1 +1,1 @@
-988
+989

Modified: erp5/trunk/bt5/erp5_dms/bt/template_portal_type_workflow_chain_list
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/bt/template_portal_type_workflow_chain_list?rev=27896&r1=27895&r2=27896&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_dms/bt/template_portal_type_workflow_chain_list [utf8] (original)
+++ erp5/trunk/bt5/erp5_dms/bt/template_portal_type_workflow_chain_list [utf8] Fri Jul  3 11:21:31 2009
@@ -3,25 +3,26 @@
 Document Ingestion Message | edit_workflow
 Drawing | document_interaction_workflow
 Drawing | document_publication_workflow
+Drawing | edit_workflow
 Drawing | local_permission_interaction_workflow
 Drawing | processing_status_workflow
-File | -edit_workflow
 File | document_interaction_workflow
 File | document_publication_workflow
 File | local_permission_interaction_workflow
 File | processing_status_workflow
-Image | -edit_workflow
 Image | document_interaction_workflow
 Image | document_publication_workflow
 Image | local_permission_interaction_workflow
 Image | processing_status_workflow
 PDF | document_interaction_workflow
 PDF | document_publication_workflow
+PDF | edit_workflow
 PDF | local_permission_interaction_workflow
 PDF | processing_status_workflow
 Person | local_permission_interaction_workflow
 Presentation | document_interaction_workflow
 Presentation | document_publication_workflow
+Presentation | edit_workflow
 Presentation | local_permission_interaction_workflow
 Presentation | processing_status_workflow
 RSS Feed | document_publication_workflow
@@ -29,10 +30,12 @@
 RSS Feed | local_permission_interaction_workflow
 Spreadsheet | document_interaction_workflow
 Spreadsheet | document_publication_workflow
+Spreadsheet | edit_workflow
 Spreadsheet | local_permission_interaction_workflow
 Spreadsheet | processing_status_workflow
 Text | document_interaction_workflow
 Text | document_publication_workflow
+Text | edit_workflow
 Text | local_permission_interaction_workflow
 Text | processing_status_workflow
 URL Crawler | document_publication_workflow

Modified: erp5/trunk/products/ERP5/Document/Document.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Document.py?rev=27896&r1=27895&r2=27896&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Document.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Document.py [utf8] Fri Jul  3 11:21:31 2009
@@ -980,26 +980,14 @@
       of the current object. The return value is a string
       in order to be consistent with the property sheet
       definition.
-      
-      NOTE: for now, workflow choice is hardcoded. This is
-      an optimisation hack. If a document does neither use
-      edit_workflow or processing_status_workflow, the
-      first workflow in the chain has prioriot. Better
-      implementation would require to be able to define
-      which workflow in a chain is the default one for
-      revision tracking (and for modification date).
-    """
-    portal_workflow = getToolByName(self, 'portal_workflow')
-    wf_list = list(portal_workflow.getWorkflowsFor(self))
-    wf = portal_workflow.getWorkflowById('edit_workflow')
-    if wf is not None: wf_list = [wf] + wf_list
-    wf = portal_workflow.getWorkflowById('processing_status_workflow')
-    if wf is not None: wf_list = [wf] + wf_list
-    for wf in wf_list:
-      history = wf.getInfoFor(self, 'history', None)
-      if history:
-        return str(len(filter(lambda x:x.get('action', None) in ('edit', 'upload'), history)))
-    return ''
+    """
+    revision = len(self.getWorkflowInfo('history', 'edit_workflow'))
+    # XXX Also look at processing_status_workflow for compatibility.
+    for history_item in self.getWorkflowInfo('history',
+                                             'processing_status_workflow'):
+      if history_item.get('action') == 'edit':
+        revision += 1
+    return str(revision)
 
   security.declareProtected(Permissions.AccessContentsInformation, 'getRevisionList')
   def getRevisionList(self):
@@ -1007,10 +995,7 @@
       Returns the list of revision numbers of the current document
       by by analysing the change log of the current object.
     """
-    revision = self.getRevision()
-    if revision == '':
-      return []
-    return [str(r) for r in range(0, int(self.getRevision()))]
+    return map(str, range(1, 1 + int(self.getRevision())))
 
   security.declareProtected(Permissions.ModifyPortalContent, 'mergeRevision')
   def mergeRevision(self):

Modified: erp5/trunk/products/ERP5/Tool/ContributionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/ContributionTool.py?rev=27896&r1=27895&r2=27896&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/ContributionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Tool/ContributionTool.py [utf8] Fri Jul  3 11:21:31 2009
@@ -364,14 +364,9 @@
           # If we need to discoverMetadata synchronously, it must
           # be for user interface and should thus be handled by
           # ZODB scripts
-
-          # XXX converting state is for only document which is necessary to
-          # convert base format.
-          portal_workflow = self.getPortalObject().portal_workflow
-          if 'processing_status_workflow' in portal_workflow.getChainFor(document):
-            document.processFile() # move to converting state.
-          document.activate().Document_convertToBaseFormatAndDiscoverMetadata(
-            file_name=name, user_login=user_login)
+          document.activate(after_path_and_method_id=(document.getPath(),
+            ('convertToBaseFormat', 'Document_tryToConvertToBaseFormat'))) \
+          .discoverMetadata(file_name=name, user_login=user_login)
       else:
         if existing_document.isExternalDocument():
           document = existing_document

Modified: erp5/trunk/products/ERP5OOo/tests/testDms.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/testDms.py?rev=27896&r1=27895&r2=27896&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testDms.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testDms.py [utf8] Fri Jul  3 11:21:31 2009
@@ -206,14 +206,14 @@
     if not run: return
     printAndLog('\nTest Revision System')
     # create a test document
-    # revision should be 0
+    # revision should be 1
     # upload file (can be the same) into it
-    # revision should now be 1
+    # revision should now be 2
     # edit the document with any value or no values
-    # revision should now be 2
+    # revision should now be 3
     # contribute the same file through portal_contributions
-    # the same document should now have revision 3 (because it should have done mergeRevision)
-    # getRevisionList should return (0, 1, 2, 3)
+    # the same document should now have revision 4 (because it should have done mergeRevision)
+    # getRevisionList should return (1, 2, 3, 4)
     filename = 'TEST-en-002.doc'
     file = makeFileUpload(filename)
     document = self.portal.portal_contributions.newContent(file=file)
@@ -223,20 +223,20 @@
     document_url = document.getRelativeUrl()
     def getTestDocument():
       return self.portal.restrictedTraverse(document_url)
-    self.failUnless(getTestDocument().getRevision() == '0')
+    self.failUnless(getTestDocument().getRevision(), '1')
     getTestDocument().edit(file=file)
     transaction.commit()
     self.tic()
-    self.failUnless(getTestDocument().getRevision() == '1')
+    self.failUnless(getTestDocument().getRevision(), '2')
     getTestDocument().edit(title='Hey Joe')
     transaction.commit()
     self.tic()
-    self.failUnless(getTestDocument().getRevision() == '2')
+    self.failUnless(getTestDocument().getRevision(), '3')
     another_document = self.portal.portal_contributions.newContent(file=file)
     transaction.commit()
     self.tic()
-    self.failUnless(getTestDocument().getRevision() == '3')
-    self.failUnless(getTestDocument().getRevisionList() == ['0', '1', '2'] )
+    self.failUnless(getTestDocument().getRevision(), '4')
+    self.failUnless(getTestDocument().getRevisionList(), ['1', '2', '3', '4'])
 
   def test_03_Versioning(self,quiet=QUIET,run=RUN_ALL_TEST):
     """

Modified: erp5/trunk/products/ERP5OOo/tests/testIngestion.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/testIngestion.py?rev=27896&r1=27895&r2=27896&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testIngestion.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testIngestion.py [utf8] Fri Jul  3 11:21:31 2009
@@ -304,7 +304,6 @@
       printAndLog('Ingesting file: ' + filename)
       f = makeFileUpload(filename)
       context.edit(file=f)
-      context.convertToBaseFormat()
       context.reindexObject()
       transaction.commit()
       self.tic()
@@ -328,7 +327,6 @@
     filename = 'TEST-en-002.' + format
     f = makeFileUpload(filename)
     context.edit(file=f)
-    context.convertToBaseFormat()
     context.reindexObject()
     transaction.commit()
     self.tic()




More information about the Erp5-report mailing list