Commit 96545cfb authored by Fabien Morin's avatar Fabien Morin

Don't use type() to test the type of a variable, see...

Don't use type() to test the type of a variable, see http://www.erp5.org/GuidelinesForPerformanceCrimes
use isinstance instead


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27057 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 75aeb46f
...@@ -72,7 +72,9 @@ class BusinessProcess(Path, XMLObject): ...@@ -72,7 +72,9 @@ class BusinessProcess(Path, XMLObject):
**kw -- same parameters as for searchValues / contentValues **kw -- same parameters as for searchValues / contentValues
""" """
# Naive implementation to redo XXX using 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,) trade_phase = (trade_phase,)
result = [] result = []
for document in self.contentValues(portal_type="Business Path"): for document in self.contentValues(portal_type="Business Path"):
...@@ -174,4 +176,4 @@ class BusinessProcess(Path, XMLObject): ...@@ -174,4 +176,4 @@ class BusinessProcess(Path, XMLObject):
Build whatever is buildable Build whatever is buildable
""" """
for path in self.getBuildablePathValueList(explanation): for path in self.getBuildablePathValueList(explanation):
path.build(explanation) path.build(explanation)
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment