[Erp5-report] r41498 nicolas - in /erp5/trunk/bt5/erp5_dms: SkinTemplateItem/portal_skins/e...
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Dec 16 15:40:04 CET 2010
Author: nicolas
Date: Thu Dec 16 15:40:03 2010
New Revision: 41498
URL: http://svn.erp5.org?rev=41498&view=rev
Log:
* Support glob patterns matching ofr content_types.
As some portal_transform chains are configured with input content_type equals to
'image/*', strict equality comparison reject wrongly content_type like 'image/png'.
* Get tools from portal itself
Modified:
erp5/trunk/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_getTargetFormatItemList.xml
erp5/trunk/bt5/erp5_dms/bt/revision
Modified: erp5/trunk/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_getTargetFormatItemList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_getTargetFormatItemList.xml?rev=41498&r1=41497&r2=41498&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_getTargetFormatItemList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_getTargetFormatItemList.xml [utf8] Thu Dec 16 15:40:03 2010
@@ -56,20 +56,29 @@
"""\n
from Products.ERP5Type.Cache import CachingMethod\n
\n
+def contentTypeMatch(content_type, glob):\n
+ if \'*\' in glob:\n
+ # \'image/png\' must match \'image/*\'\n
+ index = glob.index(\'*\')\n
+ return content_type[:index] == glob[:index]\n
+ else:\n
+ return content_type == glob\n
+\n
+portal = context.getPortalObject()\n
content_type = context.getContentType()\n
\n
def getTargetFormatItemList(content_type):\n
format_list = []\n
output_content_type_list = []\n
- for obj in context.portal_transforms.objectValues():\n
+ for obj in portal.portal_transforms.objectValues():\n
for input in obj.inputs:\n
- if input==content_type and \\\n
+ if contentTypeMatch(content_type, input) and \\\n
obj.output not in output_content_type_list and\\\n
obj.output!=content_type:\n
output_content_type_list.append(obj.output)\n
\n
for output_content_type in output_content_type_list:\n
- mimetypes_registry_extension_list = context.mimetypes_registry.lookup(output_content_type)\n
+ mimetypes_registry_extension_list = portal.mimetypes_registry.lookup(output_content_type)\n
for mimetypes_registry_extension in mimetypes_registry_extension_list:\n
title = mimetypes_registry_extension.name()\n
try:\n
@@ -129,8 +138,10 @@ return getTargetFormatItemList(content_t
<tuple>
<string>Products.ERP5Type.Cache</string>
<string>CachingMethod</string>
+ <string>contentTypeMatch</string>
<string>_getattr_</string>
<string>context</string>
+ <string>portal</string>
<string>content_type</string>
<string>getTargetFormatItemList</string>
</tuple>
Modified: erp5/trunk/bt5/erp5_dms/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/bt/revision?rev=41498&r1=41497&r2=41498&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_dms/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_dms/bt/revision [utf8] Thu Dec 16 15:40:03 2010
@@ -1 +1 @@
-1222
\ No newline at end of file
+1225
\ No newline at end of file
More information about the Erp5-report
mailing list