From 7b887cdbc30a91e2cc790fae5e639d4f228d6e73 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bartek=20G=C3=B3rny?= <bartek@gorny.edu.pl>
Date: Thu, 28 Sep 2006 14:51:30 +0000
Subject: [PATCH] changed ingestion process - a doc should be converted after
 it was processed (or ingested) no matter where it came from

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10412 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../portal_skins/erp5_dms/DMS_ingestFile.xml  |  6 +++++
 .../erp5_dms/OOoDocument_convertAfter.xml}    | 25 +++++++++++--------
 bt5/erp5_dms/bt/revision                      |  2 +-
 3 files changed, 22 insertions(+), 11 deletions(-)
 rename bt5/erp5_dms/{WorkflowTemplateItem/portal_workflow/ooo_interaction_workflow/scripts/Convert_after.xml => SkinTemplateItem/portal_skins/erp5_dms/OOoDocument_convertAfter.xml} (89%)

diff --git a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_ingestFile.xml b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_ingestFile.xml
index 2a0906d765..b91d5aaf2c 100644
--- a/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_ingestFile.xml
+++ b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/DMS_ingestFile.xml
@@ -81,6 +81,11 @@ if fname is not None:\n
   context.guessMimeType(fname)\n
   if not context.getTitle():\n
     context.setTitle(fname)\n
+  # use duck typing to check if it is OOo\n
+  if hasattr(context,\'convert\') and hasattr(context,\'hasFile\') and hasattr(context,\'hasOOfile\'):\n
+    context.reset()\n
+    if context.hasFile() and not context.hasOOfile():\n
+      context.activate( activity  = \'SQLQueue\').OOoDocument_convertAfter()\n
 </string> </value>
         </item>
         <item>
@@ -128,6 +133,7 @@ if fname is not None:\n
                             <string>None</string>
                             <string>_getattr_</string>
                             <string>context</string>
+                            <string>hasattr</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/ooo_interaction_workflow/scripts/Convert_after.xml b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/OOoDocument_convertAfter.xml
similarity index 89%
rename from bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/ooo_interaction_workflow/scripts/Convert_after.xml
rename to bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/OOoDocument_convertAfter.xml
index 38261a93df..ae1843e423 100644
--- a/bt5/erp5_dms/WorkflowTemplateItem/portal_workflow/ooo_interaction_workflow/scripts/Convert_after.xml
+++ b/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/OOoDocument_convertAfter.xml
@@ -68,11 +68,8 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>ob=state_change.object\n
-ob.log(ob.getRelativeUrl())\n
-ob.log(ob.hasFile())\n
-ob.log(ob.hasOOfile())\n
-if ob.hasFile() and not ob.hasOOfile():\n
+            <value> <string>ob=context\n
+if ob.hasFile() and not ob.hasOOfile(): #doublecheck\n
   try:\n
     res=ob.convert()\n
     ob.log(res)\n
@@ -95,9 +92,15 @@ if ob.hasFile() and not ob.hasOOfile():\n
               <none/>
             </value>
         </item>
+        <item>
+            <key> <string>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>state_change</string> </value>
+            <value> <string>*a,**kw</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -117,15 +120,17 @@ if ob.hasFile() and not ob.hasOOfile():\n
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>1</int> </value>
+                        <value> <int>0</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
-                            <string>state_change</string>
-                            <string>_getattr_</string>
+                            <string>a</string>
+                            <string>kw</string>
+                            <string>context</string>
                             <string>ob</string>
+                            <string>_getattr_</string>
                             <string>res</string>
                             <string>str</string>
                             <string>_getitem_</string>
@@ -147,7 +152,7 @@ if ob.hasFile() and not ob.hasOOfile():\n
         </item>
         <item>
             <key> <string>id</string> </key>
-            <value> <string>Convert_after</string> </value>
+            <value> <string>OOoDocument_convertAfter</string> </value>
         </item>
         <item>
             <key> <string>warnings</string> </key>
diff --git a/bt5/erp5_dms/bt/revision b/bt5/erp5_dms/bt/revision
index 6e16ebf9e9..b7c52fb181 100644
--- a/bt5/erp5_dms/bt/revision
+++ b/bt5/erp5_dms/bt/revision
@@ -1 +1 @@
-208
\ No newline at end of file
+212
\ No newline at end of file
-- 
2.30.9