[Erp5-report] r40066 jm - /erp5/trunk/products/ERP5/Tool/TemplateTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Nov 8 18:18:49 CET 2010
Author: jm
Date: Mon Nov 8 18:18:48 2010
New Revision: 40066
URL: http://svn.erp5.org?rev=40066&view=rev
Log:
Speed up TemplateTool.getFilterDiff
Modified:
erp5/trunk/products/ERP5/Tool/TemplateTool.py
Modified: erp5/trunk/products/ERP5/Tool/TemplateTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/TemplateTool.py?rev=40066&r1=40065&r2=40066&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/TemplateTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Tool/TemplateTool.py [utf8] Mon Nov 8 18:18:48 2010
@@ -633,13 +633,13 @@ class TemplateTool (BaseTool):
"""
Return list of scripts usable to filter diff
"""
- # XXX, the or [] should not be there, the preference tool is
+ # XXX, the "or ()" should not be there, the preference tool is
# inconsistent, the called method should not return None when
# nothing is selected
- script_id_list = self.getPortalObject().portal_preferences\
- .getPreferredDiffFilterScriptIdList() or []
-
- return [getattr(self, x) for x in script_id_list]
+ portal = self.getPortalObject()
+ script_id_list = portal.portal_preferences\
+ .getPreferredDiffFilterScriptIdList() or ()
+ return [getattr(portal, x) for x in script_id_list]
def getFilteredDiffAsHTML(self, diff):
"""
@@ -653,11 +653,13 @@ class TemplateTool (BaseTool):
"""
diff_file_object = DiffFile(diff)
diff_block_list = diff_file_object.getModifiedBlockList()
- if len(diff_block_list):
- for script in self.getDiffFilterScriptList():
- for block, line_tuple in diff_block_list:
+ if diff_block_list:
+ script_list = self.getDiffFilterScriptList()
+ for block, line_tuple in diff_block_list:
+ for script in script_list:
if script(line_tuple[0], line_tuple[1]):
diff_file_object.children.remove(block)
+ break
# XXX-Aurel : this method should return a text diff but
# DiffFile does not provide yet such feature
return diff_file_object
More information about the Erp5-report
mailing list