Commit 000b1b17 authored by Bartek Górny's avatar Bartek Górny

automatic assignment of properties from a parsed filename; regexp stored in preferences

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9484 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3e3859d1
......@@ -62,6 +62,7 @@
<value>
<list>
<string>left</string>
<string>right</string>
</list>
</value>
</item>
......@@ -75,6 +76,16 @@
<list>
<string>my_preferred_dms_ooodoc_server_address</string>
<string>my_preferred_dms_ooodoc_server_port_number</string>
<string>my_preferred_dms_reference_regexp</string>
<string>my_preferred_dms_filename_regexp</string>
<string>my_preferred_dms_reference_function</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list>
<string>my_preferred_dms_base_category_list_list</string>
</list>
</value>
......
......@@ -41,6 +41,7 @@
<value>
<list>
<string>AssignCategories</string>
<string>SetReferenceFromFilename</string>
</list>
</value>
</item>
......@@ -71,8 +72,8 @@
<value>
<list>
<string>DMS File</string>
<string>DMS Pdf File</string>
<string>Graphic</string>
<string>PdfDocument</string>
<string>Presentation</string>
<string>Spreadsheet</string>
<string>Text</string>
......
......@@ -70,7 +70,7 @@
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>DMS Pdf File</string>
<string>PdfDocument</string>
</list>
</value>
</item>
......
......@@ -83,11 +83,9 @@ if f is not None and f:\n
context.log(context.getPortalType(),ctype)\n
if ctype is not None:\n
raise Exception(\'This file should be created as \'+ctype)\n
ob.setOriginalFilename(fname)\n
ob.setSourceReference(fname)\n
if not ob.getTitle():\n
ob.setTitle(fname)\n
if not ob.getReference():\n
ob.setReference(fname)\n
</string> </value>
</item>
<item>
......
......@@ -85,11 +85,9 @@ if f is not None and f:\n
raise Exception(\'This file should be created as DMS File\')\n
if ctype!=ob.getPortalType():\n
raise Exception(\'This file should be created as \'+ctype)\n
ob.setOriginalFilename(fname)\n
ob.setSourceReference(fname)\n
if not ob.getTitle():\n
ob.setTitle(fname)\n
if not ob.getReference():\n
ob.setReference(fname)\n
</string> </value>
</item>
<item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>ob=state_change.object\n
kw=ob.REQUEST\n
ob.log(\'interaction\',\'edit\')\n
f=kw.get(\'my_file\',None)\n
ob.log(\'f\',f)\n
\n
if f is not None and f:\n
# if file uploaded, then:\n
ob.log(\'file\',f)\n
fname=f.filename\n
ob.setPropertiesFromFilename(fname)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>state_change</string>
<string>_getattr_</string>
<string>ob</string>
<string>kw</string>
<string>None</string>
<string>f</string>
<string>fname</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SetReferenceFromFilename</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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