[Erp5-report] r36808 ivan - in /erp5/trunk/bt5/erp5_dms: SkinTemplateItem/portal_skins/erp5...

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jul 2 15:15:32 CEST 2010


Author: ivan
Date: Fri Jul  2 15:15:28 2010
New Revision: 36808

URL: http://svn.erp5.org?rev=36808&view=rev
Log:
Add script that is able to determine (based on content_type) list of possible convert to target format lists.
Script is used (and uses) for portal types that do rely on portal_transforms & mimetypes_registry.

Added:
    erp5/trunk/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_getTargetFormatItemList.xml
Modified:
    erp5/trunk/bt5/erp5_dms/bt/revision

Added: 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=36808&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_getTargetFormatItemList.xml (added)
+++ erp5/trunk/bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_getTargetFormatItemList.xml [utf8] Fri Jul  2 15:15:28 2010
@@ -0,0 +1,166 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </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>"""\n
+  Returns a list of acceptable formats for conversion\n
+  in the form of tuples (for listfield in ERP5Form)\n
+"""\n
+from Products.ERP5Type.Cache import CachingMethod\n
+\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 input in obj.inputs:\n
+      if input==content_type 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
+    for mimetypes_registry_extension in mimetypes_registry_extension_list:\n
+      title = mimetypes_registry_extension.name()\n
+      try:\n
+        format = mimetypes_registry_extension.extensions[0]\n
+      except IndexError:\n
+        format = None\n
+      if format is not None and format not in format_list:\n
+        format_list.append((title, format,))\n
+  return format_list\n
+\n
+getTargetFormatItemList = CachingMethod(getTargetFormatItemList,\n
+                                        id=\'Base_getTargetFormatItemList\',\n
+                                        cache_factory=\'erp5_ui_long\')\n
+\n
+return getTargetFormatItemList(content_type)\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>_proxy_roles</string> </key>
+            <value>
+              <tuple/>
+            </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>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>Products.ERP5Type.Cache</string>
+                            <string>CachingMethod</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>content_type</string>
+                            <string>getTargetFormatItemList</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>Base_getTargetFormatItemList</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: erp5/trunk/bt5/erp5_dms/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_dms/bt/revision?rev=36808&r1=36807&r2=36808&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_dms/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_dms/bt/revision [utf8] Fri Jul  2 15:15:28 2010
@@ -1 +1 @@
-1155
\ No newline at end of file
+1156
\ No newline at end of file




More information about the Erp5-report mailing list