Commit 21a3e374 authored by Ivan Tyagov's avatar Ivan Tyagov

Use only content_type_registry to get portal_type by extension. Define more extensions.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14204 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d2bfa36b
...@@ -143,6 +143,7 @@ ...@@ -143,6 +143,7 @@
<value> <value>
<list> <list>
<string>sxd</string> <string>sxd</string>
<string>odg</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -202,10 +203,12 @@ ...@@ -202,10 +203,12 @@
<list> <list>
<string>gif</string> <string>gif</string>
<string>jpg</string> <string>jpg</string>
<string>jpeg</string>
<string>png</string> <string>png</string>
<string>bmp</string> <string>bmp</string>
<string>GIF</string> <string>GIF</string>
<string>JPG</string> <string>JPG</string>
<string>JPEG</string>
<string>PNG</string> <string>PNG</string>
<string>BMP</string> <string>BMP</string>
</list> </list>
...@@ -293,6 +296,7 @@ ...@@ -293,6 +296,7 @@
<string>xls</string> <string>xls</string>
<string>ods</string> <string>ods</string>
<string>sdc</string> <string>sdc</string>
<string>sxc</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -68,25 +68,8 @@ ...@@ -68,25 +68,8 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>typetoext = {\n <value> <string>pt = context.content_type_registry.findTypeName(\'a.%s\' %ext, None, None)\n
\'Text\':(\'doc\', \'sxw\', \'odt\', \'txt\', \'rtf\'),\n return pt\n
\'Spreadsheet\':(\'xls\', \'sxc\', \'ods\'),\n
\'Presentation\':(\'ppt\', \'odp\'),\n
\'Drawing\':(\'odg\',),\n
\'Image\':(\'jpg\', \'jpeg\', \'gif\', \'bmp\', \'png\'),\n
\'PDF\':(\'pdf\',),\n
}\n
\n
multitypes = {\n
# \'Text\':(\'Text\', \'Memo\')\n
}\n
context.log(ext)\n
\n
for ptype, ext_list in typetoext.items():\n
if ext in ext_list:\n
return multitypes.get(ptype, (ptype,))\n
\n
return ()\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -130,13 +113,10 @@ return ()\n ...@@ -130,13 +113,10 @@ return ()\n
<value> <value>
<tuple> <tuple>
<string>ext</string> <string>ext</string>
<string>typetoext</string>
<string>multitypes</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>_getiter_</string> <string>None</string>
<string>ptype</string> <string>pt</string>
<string>ext_list</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
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