Commit 3e3859d1 authored by Bartek Górny's avatar Bartek Górny

Changed way to store original filename;

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9483 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 36eee522
<catalog_method>
<item key="sql_clear_catalog" type="int">
<value>1</value>
</item>
</catalog_method>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ZSQLMethods.SQL</string>
<string>SQL</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_arg</string> </key>
<value>
<object>
<klass>
<global name="Args" module="Shared.DC.ZRDB.Aqueduct"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_data</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>_keys</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z0_drop_dmsdocinfo</string> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string>DROP TABLE dmsdocinfo</string> </value>
</item>
<item>
<key> <string>template</string> </key>
<value>
<object>
<klass>
<global name="SQL" module="Shared.DC.ZRDB.DA"/>
</klass>
<none/>
<state>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string encoding="cdata"><![CDATA[
<string>
]]></string> </value>
</item>
<item>
<key> <string>_vars</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>globals</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>raw</string> </key>
<value> <string>DROP TABLE dmsdocinfo</string> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<catalog_method>
<item key="sql_uncatalog_object" type="int">
<value>1</value>
</item>
</catalog_method>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ZSQLMethods.SQL</string>
<string>SQL</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_arg</string> </key>
<value>
<object>
<klass>
<global name="Args" module="Shared.DC.ZRDB.Aqueduct"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_data</string> </key>
<value>
<dictionary>
<item>
<key> <string>uid</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_keys</string> </key>
<value>
<list>
<string>uid</string>
</list>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>uid</string> </value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z0_uncatalog_dmsdocinfo</string> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
DELETE FROM dmsdocinfo WHERE <dtml-sqltest uid op=eq type=int>
]]></string> </value>
</item>
<item>
<key> <string>template</string> </key>
<value>
<object>
<klass>
<global name="SQL" module="Shared.DC.ZRDB.DA"/>
</klass>
<none/>
<state>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string encoding="cdata"><![CDATA[
<string>
]]></string> </value>
</item>
<item>
<key> <string>_vars</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>globals</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[
DELETE FROM dmsdocinfo WHERE <dtml-sqltest uid op=eq type=int>
]]></string> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<catalog_method>
<item key="sql_catalog_object_list" type="int">
<value>1</value>
</item>
</catalog_method>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ZSQLMethods.SQL</string>
<string>SQL</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_arg</string> </key>
<value>
<object>
<klass>
<global name="Args" module="Shared.DC.ZRDB.Aqueduct"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_data</string> </key>
<value>
<dictionary>
<item>
<key> <string>getOriginalFilename</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>getPortalType</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>uid</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_keys</string> </key>
<value>
<list>
<string>uid</string>
<string>getOriginalFilename</string>
<string>getPortalType</string>
</list>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>uid\r\n
getOriginalFilename\r\n
getPortalType</string> </value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_catalog_dmsdocinfo_list</string> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-let doc_list="[]">\n
<dtml-in prefix="loop" expr="_.range(_.len(uid))">\n
<dtml-if expr="getPortalType[loop_item] in (\'Text\',\'Spreadsheet\',\'Presentation\',\'Graphic\',\'DMS File\',\'DMS Pdf File\')">\n
<dtml-call expr="doc_list.append(loop_item)">\n
</dtml-if>\n
</dtml-in>\n
<dtml-if expr="_.len(doc_list) > 0">\n
REPLACE INTO\n
dmsdocinfo\n
VALUES\n
<dtml-in prefix="loop" expr="doc_list">\n
(\n
<dtml-sqlvar expr="uid[loop_item]" type="int">, \n
<dtml-sqlvar expr="getOriginalFilename[loop_item]" type="string" optional>\n
)\n
<dtml-if sequence-end><dtml-else>,</dtml-if>\n
</dtml-in>\n
</dtml-if>\n
</dtml-let>
]]></string> </value>
</item>
<item>
<key> <string>template</string> </key>
<value>
<object>
<klass>
<global name="SQL" module="Shared.DC.ZRDB.DA"/>
</klass>
<none/>
<state>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string encoding="cdata"><![CDATA[
<string>
]]></string> </value>
</item>
<item>
<key> <string>_vars</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>globals</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[
<dtml-let doc_list="[]">\n
<dtml-in prefix="loop" expr="_.range(_.len(uid))">\n
<dtml-if expr="getPortalType[loop_item] in (\'Text\',\'Spreadsheet\',\'Presentation\',\'Graphic\',\'DMS File\',\'DMS Pdf File\')">\n
<dtml-call expr="doc_list.append(loop_item)">\n
</dtml-if>\n
</dtml-in>\n
<dtml-if expr="_.len(doc_list) > 0">\n
REPLACE INTO\n
dmsdocinfo\n
VALUES\n
<dtml-in prefix="loop" expr="doc_list">\n
(\n
<dtml-sqlvar expr="uid[loop_item]" type="int">, \n
<dtml-sqlvar expr="getOriginalFilename[loop_item]" type="string" optional>\n
)\n
<dtml-if sequence-end><dtml-else>,</dtml-if>\n
</dtml-in>\n
</dtml-if>\n
</dtml-let>
]]></string> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<catalog_method>
<item key="sql_clear_catalog" type="int">
<value>1</value>
</item>
</catalog_method>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ZSQLMethods.SQL</string>
<string>SQL</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_arg</string> </key>
<value>
<object>
<klass>
<global name="Args" module="Shared.DC.ZRDB.Aqueduct"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_data</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>_keys</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_col</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_create_dmsdocinfo</string> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string>CREATE TABLE `dmsdocinfo` (\n
`uid` BIGINT UNSIGNED NOT NULL,\n
`original_filename` varchar(255),\n
PRIMARY KEY `uid` (`uid`),\n
KEY `original_filename` (`original_filename`)\n
) TYPE = InnoDB;</string> </value>
</item>
<item>
<key> <string>template</string> </key>
<value>
<object>
<klass>
<global name="SQL" module="Shared.DC.ZRDB.DA"/>
</klass>
<none/>
<state>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string encoding="cdata"><![CDATA[
<string>
]]></string> </value>
</item>
<item>
<key> <string>_vars</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>globals</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>raw</string> </key>
<value> <string>CREATE TABLE `dmsdocinfo` (\n
`uid` BIGINT UNSIGNED NOT NULL,\n
`original_filename` varchar(255),\n
PRIMARY KEY `uid` (`uid`),\n
KEY `original_filename` (`original_filename`)\n
) TYPE = InnoDB;</string> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -3,8 +3,8 @@ import re ...@@ -3,8 +3,8 @@ import re
# parsing defined here # parsing defined here
r=re.compile('(\w+:"[^"]+"|\w+:[\w\-.]+)') r=re.compile('(\w+:"[^"]+"|\w+:[\w\-.]+)')
filetyper=lambda s:('original_filename','%%.%s' % s) filetyper=lambda s:('source_reference','%%.%s' % s)
filestripper=lambda s: ('original_filename',s.replace('"','')) filestripper=lambda s: ('source_reference',s.replace('"',''))
paramsmap=dict(file=filestripper,type='portal_type',reference='reference',filetype=filetyper) paramsmap=dict(file=filestripper,type='portal_type',reference='reference',filetype=filetyper)
def analyze(params): def analyze(params):
......
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
<string>my_int_index</string> <string>my_int_index</string>
<string>my_validation_state</string> <string>my_validation_state</string>
<string>my_file</string> <string>my_file</string>
<string>my_original_filename</string> <string>my_source_reference</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_original_filename</string> </value> <value> <string>my_source_reference</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -78,7 +78,8 @@ if ctype is None:\n ...@@ -78,7 +78,8 @@ if ctype is None:\n
\n \n
# create content\n # create content\n
ob=context.document_module.newContent(portal_type=ctype,file=data)\n ob=context.document_module.newContent(portal_type=ctype,file=data)\n
ob.setOriginalFilename(fname)\n ob.setSourceReference(fname)\n
ob.setPropertiesFromFilename(fname)\n
ob.guessMimeType(fname)\n ob.guessMimeType(fname)\n
code,msg=ob.convert()\n code,msg=ob.convert()\n
if code>0:\n if code>0:\n
......
...@@ -354,8 +354,8 @@ ...@@ -354,8 +354,8 @@
<string>State</string> <string>State</string>
</tuple> </tuple>
<tuple> <tuple>
<string>original_filename</string> <string>source_reference</string>
<string>original_filename</string> <string>source_reference</string>
</tuple> </tuple>
</list> </list>
</value> </value>
......
...@@ -80,7 +80,6 @@ ...@@ -80,7 +80,6 @@
<string>my_description</string> <string>my_description</string>
<string>my_keywords</string> <string>my_keywords</string>
<string>my_subject</string> <string>my_subject</string>
<string>my_original_filename</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -109,6 +108,7 @@ ...@@ -109,6 +108,7 @@
<string>my_int_index</string> <string>my_int_index</string>
<string>my_validation_state</string> <string>my_validation_state</string>
<string>my_file</string> <string>my_file</string>
<string>my_source_reference</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -3,15 +3,18 @@ ...@@ -3,15 +3,18 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<global name="StringField" module="Products.Formulator.StandardFields"/> <tuple>
<tuple/> <string>Products.Formulator.StandardFields</string>
<string>StringField</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_original_filename</string> </value> <value> <string>my_source_reference</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -100,7 +100,7 @@ if f is not None and f:\n ...@@ -100,7 +100,7 @@ if f is not None and f:\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.setOriginalFilename(fname)\n ob.setSourceReference(fname)\n
ob.setTitle(fname)\n ob.setTitle(fname)\n
ob.setLastUploadTime(DateTime())\n ob.setLastUploadTime(DateTime())\n
ob.clearCache()\n ob.clearCache()\n
......
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