[Erp5-report] r41515 jm - in /erp5/trunk/products: ERP5/Document/ ERP5/bootstrap/erp5_core/...

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Dec 17 22:12:00 CET 2010


Author: jm
Date: Fri Dec 17 22:11:59 2010
New Revision: 41515

URL: http://svn.erp5.org?rev=41515&view=rev
Log:
More XML clean up for Python Scripts

Now that most erp5_* Business Templates can only be installed on instances using
new portal types as classes, it is possible to enable clean up that was
implemented by commit 38348.

Removed:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_filterAppendToListDiff.xml
Modified:
    erp5/trunk/products/ERP5/Document/BusinessTemplate.py
    erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
    erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py

Modified: erp5/trunk/products/ERP5/Document/BusinessTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessTemplate.py?rev=41515&r1=41514&r2=41515&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] Fri Dec 17 22:11:59 2010
@@ -560,11 +560,11 @@ class BaseTemplateItem(Implicit, Persist
       # PythonScript covers both Zope Python scripts
       # and ERP5 Python Scripts
       if isinstance(obj, PythonScript):
-        # XXX forward compatibility: set to None instead of deleting '_code'
-        #     so that old BT code can import recent BT
-        obj._code = None
-        attr_set.update((#'func_code', 'func_defaults', '_code',
+        attr_set.update(('func_code', 'func_defaults', '_code',
                          '_lazy_compilation', 'Python_magic'))
+        for attr in 'errors', 'warnings', '_proxy_roles':
+          if not obj.__dict__.get(attr, 1):
+            delattr(obj, attr)
       #elif classname == 'SQL' and klass.__module__== 'Products.ZSQLMethods':
       #  attr_set.update(('_arg', 'template'))
       elif interfaces.IIdGenerator.providedBy(obj):

Removed: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_filterAppendToListDiff.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_filterAppendToListDiff.xml?rev=41514&view=auto
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_filterAppendToListDiff.xml [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/TemplateTool_filterAppendToListDiff.xml (removed)
@@ -1,157 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="Python Script" module="erp5.portal_type"/>
-    </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 encoding="cdata"><![CDATA[
-
-if len(old_line_list) == 2 and len(new_line_list) == 1 and \\\n
-   old_line_list[0] == \'<string>append</string>\' and \\\n
-   old_line_list[1] == \'<string>$append0</string>\' and \\\n
-   new_line_list[0] ==\'<string>$list0</string>\':\n
-    return True\n
-\n
-return False\n
-
-
-]]></string> </value>
-        </item>
-        <item>
-            <key> <string>_code</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>_params</string> </key>
-            <value> <string>old_line_list, new_line_list</string> </value>
-        </item>
-        <item>
-            <key> <string>categories</string> </key>
-            <value>
-              <tuple>
-                <string>callable_type/script/diff_filter</string>
-              </tuple>
-            </value>
-        </item>
-        <item>
-            <key> <string>description</string> </key>
-            <value> <string encoding="cdata"><![CDATA[
-
-This script filter this kind of xml changes :\n
--                            <string>append</string>\n
--                            <string>$append0</string>\n
-+                            <string>$list0</string>\n
-
-
-]]></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>2</int> </value>
-                    </item>
-                    <item>
-                        <key> <string>co_varnames</string> </key>
-                        <value>
-                          <tuple>
-                            <string>old_line_list</string>
-                            <string>new_line_list</string>
-                            <string>len</string>
-                            <string>_getitem_</string>
-                            <string>True</string>
-                            <string>False</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>TemplateTool_filterAppendToListDiff</string> </value>
-        </item>
-        <item>
-            <key> <string>portal_type</string> </key>
-            <value> <string>Python Script</string> </value>
-        </item>
-        <item>
-            <key> <string>warnings</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision?rev=41515&r1=41514&r2=41515&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision [utf8] Fri Dec 17 22:11:59 2010
@@ -1 +1 @@
-40836
\ No newline at end of file
+40837
\ No newline at end of file

Modified: erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py?rev=41515&r1=41514&r2=41515&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] Fri Dec 17 22:11:59 2010
@@ -1271,7 +1271,7 @@ def optimize():
 
   # Delay the compilations of Python Scripts until they are really executed.
   from Products.PythonScripts.PythonScript import PythonScript
-  # In the future, Python Scripts will be exported without those 2 attributes:
+  # Python Scripts are exported without those 2 attributes:
   PythonScript.func_code = lazy_func_prop('func_code', None)
   PythonScript.func_defaults = lazy_func_prop('func_defaults', None)
 
@@ -1296,19 +1296,6 @@ def optimize():
       self._filepath = self.get_filepath()
   PythonScript._makeFunction = _makeFunction
 
-  # XXX Previous implementation of this 'optimize' function requires that
-  #     Python Scripts always contain up-to-date data for 'func_code' and
-  #     'func_defaults' properties, so make sure we always export them.
-  #     This compatibility code is not required for normal ERP5 instances
-  #     because scripts are compiled at BT installation.
-  from Products.ERP5.Document.BusinessTemplate import BaseTemplateItem
-  BaseTemplateItem_removeProperties = BaseTemplateItem.removeProperties
-  def removeProperties(self, obj, export):
-    if export and isinstance(obj, PythonScript):
-      obj.func_code # trigger compilation if needed
-    return BaseTemplateItem_removeProperties(self, obj, export)
-  BaseTemplateItem.removeProperties = removeProperties
-
   # Do not reindex portal types sub objects by default
   # We will probably disable reindexing for other types later
   full_indexing_set = set(os.environ.get('enable_full_indexing', '').split(','))



More information about the Erp5-report mailing list