Commit 1c0aeb58 authored by Bartek Górny's avatar Bartek Górny

use object_exchange for all downloads; simplified OOo info handling; cleared...

use object_exchange for all downloads; simplified OOo info handling; cleared reduntant "log" commands; tidying up and fixing basic actions;

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10354 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2e722104
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</item> </item>
<item> <item>
<key> <string>category</string> </key> <key> <string>category</string> </key>
<value> <string>object_action</string> </value> <value> <string>object_exchange</string> </value>
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</item> </item>
<item> <item>
<key> <string>category</string> </key> <key> <string>category</string> </key>
<value> <string>object_action</string> </value> <value> <string>object_exchange</string> </value>
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</item> </item>
<item> <item>
<key> <string>category</string> </key> <key> <string>category</string> </key>
<value> <string>object_action</string> </value> <value> <string>object_exchange</string> </value>
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</item> </item>
<item> <item>
<key> <string>priority</string> </key> <key> <string>priority</string> </key>
<value> <float>6.0</float> </value> <value> <float>20.0</float> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>python:object.hasSnapshot()</string> </value> <value> <string>python:object.hasFile()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>python:object.hasFile() and object.isFileUploaded()</string> </value> <value> <string>python:object.hasFile() and not object.hasOOfile()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</item> </item>
<item> <item>
<key> <string>category</string> </key> <key> <string>category</string> </key>
<value> <string>object_action</string> </value> <value> <string>object_exchange</string> </value>
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</item> </item>
<item> <item>
<key> <string>category</string> </key> <key> <string>category</string> </key>
<value> <string>object_action</string> </value> <value> <string>object_exchange</string> </value>
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</item> </item>
<item> <item>
<key> <string>category</string> </key> <key> <string>category</string> </key>
<value> <string>object_action</string> </value> <value> <string>object_exchange</string> </value>
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</item> </item>
<item> <item>
<key> <string>priority</string> </key> <key> <string>priority</string> </key>
<value> <float>6.0</float> </value> <value> <float>20.0</float> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>python:object.hasSnapshot()</string> </value> <value> <string>python:object.hasFile()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>python:object.hasOOfile() and not object.isFileUploaded()</string> </value> <value> <string>python:object.hasOOfile()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>python:object.hasFile() and object.isFileUploaded()</string> </value> <value> <string>python:object.hasFile() and not object.hasOOfile()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</item> </item>
<item> <item>
<key> <string>category</string> </key> <key> <string>category</string> </key>
<value> <string>object_action</string> </value> <value> <string>object_exchange</string> </value>
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</item> </item>
<item> <item>
<key> <string>priority</string> </key> <key> <string>priority</string> </key>
<value> <float>10.0</float> </value> <value> <float>20.0</float> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</item> </item>
<item> <item>
<key> <string>category</string> </key> <key> <string>category</string> </key>
<value> <string>object_action</string> </value> <value> <string>object_exchange</string> </value>
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</item> </item>
<item> <item>
<key> <string>category</string> </key> <key> <string>category</string> </key>
<value> <string>object_action</string> </value> <value> <string>object_exchange</string> </value>
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</item> </item>
<item> <item>
<key> <string>priority</string> </key> <key> <string>priority</string> </key>
<value> <float>6.0</float> </value> <value> <float>10.0</float> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>python:object.hasSnapshot()</string> </value> <value> <string>python:object.hasFile()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>python:object.hasOOfile() and not object.isFileUploaded()</string> </value> <value> <string>python:object.hasOOfile()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>python:object.hasFile() and object.isFileUploaded()</string> </value> <value> <string>python:object.hasFile() and not object.hasOOfile()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</item> </item>
<item> <item>
<key> <string>category</string> </key> <key> <string>category</string> </key>
<value> <string>object_action</string> </value> <value> <string>object_exchange</string> </value>
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</item> </item>
<item> <item>
<key> <string>category</string> </key> <key> <string>category</string> </key>
<value> <string>object_action</string> </value> <value> <string>object_exchange</string> </value>
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</item> </item>
<item> <item>
<key> <string>category</string> </key> <key> <string>category</string> </key>
<value> <string>object_action</string> </value> <value> <string>object_exchange</string> </value>
</item> </item>
<item> <item>
<key> <string>condition</string> </key> <key> <string>condition</string> </key>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</item> </item>
<item> <item>
<key> <string>priority</string> </key> <key> <string>priority</string> </key>
<value> <float>6.0</float> </value> <value> <float>20.0</float> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>python:object.hasSnapshot()</string> </value> <value> <string>python:object.hasFile()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>python:object.hasOOfile() and not object.isFileUploaded()</string> </value> <value> <string>python:object.hasOOfile()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -72,11 +72,9 @@ ...@@ -72,11 +72,9 @@
kw=ob.REQUEST\n kw=ob.REQUEST\n
ob.log(\'interaction\',\'edit\')\n ob.log(\'interaction\',\'edit\')\n
f=kw.get(\'my_file\',None)\n f=kw.get(\'my_file\',None)\n
ob.log(\'f\',f)\n
\n \n
if f is not None and f:\n if f is not None and f:\n
# if file uploaded, then:\n # if file uploaded, then:\n
ob.log(\'file\',f)\n
fname=f.filename\n fname=f.filename\n
# we check for appropriate file type (by extension, using content_type_registry)\n # we check for appropriate file type (by extension, using content_type_registry)\n
ctype=context.content_type_registry.findTypeName(fname,None,None)\n ctype=context.content_type_registry.findTypeName(fname,None,None)\n
......
...@@ -70,39 +70,32 @@ ...@@ -70,39 +70,32 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>ob=state_change.object\n <value> <string>ob=state_change.object\n
kw=ob.REQUEST\n kw=ob.REQUEST\n
#ob.log(\'interaction\',\'edit\')\n
metafields=(\'title\',\'subject\',\'keywords\',\'description\',\'reference\',\'version\',\'language\')\n metafields=(\'title\',\'subject\',\'keywords\',\'description\',\'reference\',\'version\',\'language\')\n
f=kw.get(\'my_file\',None)\n f=kw.get(\'my_file\',None)\n
#ob.log(\'f\',f)\n
\n \n
# edit metadata (only if we have OOo file)\n # edit metadata (only if we have OOo file)\n
if ob.hasOOfile():\n if ob.hasOOfile():\n
newmeta={}\n newmeta={}\n
# ob.log(\'metafields\',metafields)\n
for mf in metafields:\n for mf in metafields:\n
keymf=\'my_\'+mf\n keymf=\'my_\'+mf\n
# ob.log(\'keymf\',keymf)\n
if kw.has_key(keymf):\n if kw.has_key(keymf):\n
# ob.log(\'newmeta[mf]\',kw[keymf])\n
newmeta[mf]=kw[keymf]\n newmeta[mf]=kw[keymf]\n
if newmeta:\n if newmeta:\n
# edit metadata via server\n # edit metadata via server\n
ob.editMetadata(newmeta)\n ob.editMetadata(newmeta)\n
# ob.log(\'newmeta\',newmeta)\n
if f is not None and f:\n if f is not None and f:\n
# if file uploaded, then:\n # if file uploaded, then:\n
# ob.log(\'file\',f)\n
fname=f.filename\n fname=f.filename\n
# we check for appropriate file type (by extension, using content_type_registry)\n # we check for appropriate file type (by extension, using content_type_registry)\n
ctype=context.content_type_registry.findTypeName(fname,None,None)\n ctype=context.content_type_registry.findTypeName(fname,None,None)\n
# context.log(context.getPortalType(),ctype)\n
if ctype is None:\n if ctype is None:\n
raise Exception(\'File type of \'+fname+\' is not registered\')\n raise Exception(\'File type of \'+fname+\' is not registered\')\n
if ctype!=ob.getPortalType():\n if ctype!=ob.getPortalType():\n
raise Exception(\'This file should be created as \'+ctype)\n raise Exception(\'This file should be created as \'+ctype)\n
ob.setSourceReference(fname)\n ob.setSourceReference(fname)\n
ob.setTitle(fname)\n ob.setTitle(fname)\n
ob.setLastUploadTime(DateTime())\n ob.oo_data=None # we clear it\n
#ob.setLastUploadTime(DateTime())\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -162,7 +155,7 @@ if f is not None and f:\n ...@@ -162,7 +155,7 @@ if f is not None and f:\n
<string>context</string> <string>context</string>
<string>ctype</string> <string>ctype</string>
<string>Exception</string> <string>Exception</string>
<string>DateTime</string> <string>oo_data</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
199 201
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment