Commit 8818a295 authored by Sebastien Robin's avatar Sebastien Robin

the first argument when we raise an error must be a subclass of Exception, so do not use strings


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4615 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9518c0b6
......@@ -36,6 +36,8 @@ from Products.ERP5.Document.Path import Path
from zLOG import LOG
class SupplyChainError(Exception): pass
class SupplyChain(Path, XMLObject):
"""
SupplyChain defines the route used to produced a resource.
......@@ -83,7 +85,7 @@ class SupplyChain(Path, XMLObject):
if (last_list_len == 1):
result = last_supply_link_list[0]
else:
raise "SupplyChainError",\
raise SupplyChainError,\
"Unable to get the last link of SupplyChain %s" %\
str(self.getRelativeUrl())
return result
......@@ -180,7 +182,7 @@ class SupplyChain(Path, XMLObject):
# Checked if we already tested this link
# to prevent infinite loop
if current_supply_link in checked_link_list:
raise "SupplyChainLoop",\
raise SupplyChainError,\
"SupplyLink %r is in a loop." % current_supply_link
else:
transformation_link_list = []
......@@ -197,7 +199,7 @@ class SupplyChain(Path, XMLObject):
# destination
if (current_supply_link is not None) and \
(current_supply_link.isProductionSupplyLink()):
raise "SupplyChainError",\
raise SupplyChainError,\
"Those SupplyLinks are in conflict: %r and %r" %\
(current_supply_link.getRelativeUrl(),\
previous_link.getRelativeUrl())
......@@ -234,7 +236,7 @@ class SupplyChain(Path, XMLObject):
# Checked if we already tested this link
# to prevent infinite loop
if current_supply_link in checked_link_list:
raise "SupplyChainLoop",\
raise SupplyChainError,\
"SupplyLink %r is in a loop." % current_supply_link
else:
packing_list_link_list = []
......
......@@ -36,6 +36,7 @@ from Products.ERP5.Document.DeliveryLine import DeliveryLine
from Products.ERP5.Document.Movement import Movement
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5.Document.Path import Path
from Products.ERP5.Document.SupplyChain import SupplyChainError
from zLOG import LOG
......@@ -129,7 +130,7 @@ class SupplyLink(Path, XMLObject):
# XXX This method has to be rewritten.
# Predicate must be used.
if len(concurrent_supply_link_list) > 1:
raise "SupplyChainError",\
raise SupplyChainError,\
"SupplyChain unable to find route."
else:
# Check if raw material is create by a production link or a packing
......
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