[Erp5-report] r27057 - /erp5/trunk/products/ERP5/Document/BusinessProcess.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue May 19 16:59:52 CEST 2009
Author: fabien
Date: Tue May 19 16:59:50 2009
New Revision: 27057
URL: http://svn.erp5.org?rev=27057&view=rev
Log:
Don't use type() to test the type of a variable, see http://www.erp5.org/GuidelinesForPerformanceCrimes
use isinstance instead
Modified:
erp5/trunk/products/ERP5/Document/BusinessProcess.py
Modified: erp5/trunk/products/ERP5/Document/BusinessProcess.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessProcess.py?rev=27057&r1=27056&r2=27057&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessProcess.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessProcess.py [utf8] Tue May 19 16:59:50 2009
@@ -72,7 +72,9 @@
**kw -- same parameters as for searchValues / contentValues
"""
# Naive implementation to redo XXX using contentValues
- if type(trade_phase) is type(''): # XXX - bad, use isinstance
+ if trade_phase is None:
+ trade_phase=[]
+ if not isinstance(trade_phase, (list, tuple)):
trade_phase = (trade_phase,)
result = []
for document in self.contentValues(portal_type="Business Path"):
@@ -174,4 +176,4 @@
Build whatever is buildable
"""
for path in self.getBuildablePathValueList(explanation):
- path.build(explanation)
+ path.build(explanation)
More information about the Erp5-report
mailing list