Commit 7bd150b9 authored by Sebastien Robin's avatar Sebastien Robin

use class Exception instead of string


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4631 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2bacf683
......@@ -36,6 +36,9 @@ from Products.ERP5.Document.OrderBuilder import OrderBuilder
from zLOG import LOG
class SelectMethodError(Exception): pass
class SelectMovementError(Exception): pass
class DeliveryBuilder(OrderBuilder):
"""
Delivery Builder objects allow to gather multiple Simulation Movements
......@@ -134,7 +137,7 @@ class DeliveryBuilder(OrderBuilder):
mvt_dict = {}
for movement in movement_list:
if mvt_dict.has_key(movement):
raise "SelectMethodError", \
raise SelectMethodError, \
"%s return %s twice (or more)" % \
(str(self.simulation_select_method_id),
str(movement.getRelativeUrl()))
......@@ -159,7 +162,7 @@ class DeliveryBuilder(OrderBuilder):
# Check if simulation movement is not already linked to a existing
# movement
if simulation_movement.getDeliveryValue() is not None:
raise "SelectMovementError",\
raise SelectMovementError,\
"simulation_movement '%s' must not be selected !" %\
simulation_movement.getRelativeUrl()
# Update simulation movement
......
......@@ -36,6 +36,9 @@ from Products.ERP5Type.Utils import convertToUpperCase
from DateTime import DateTime
from zLOG import LOG
class CollectError(Exception): pass
class MatrixError(Exception): pass
class OrderBuilder(XMLObject, Amount, Predicate):
"""
Order Builder objects allow to gather multiple Simulation Movements
......@@ -441,7 +444,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
else:
movement_list = movement_group.getMovementList()
if len(movement_list) != 1:
raise "CollectError", "DeliveryBuilder: %s unable to distinct those\
raise CollectError, "DeliveryBuilder: %s unable to distinct those\
movements: %s" % (self.getId(), str(movement_list))
else:
# XXX Hardcoded value
......@@ -489,7 +492,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
getVariationBaseCategoryList())
object_to_update = cell
else:
raise 'MatrixError', 'Cell: %s already exists on %s' % \
raise MatrixError, 'Cell: %s already exists on %s' % \
(str(cell_key), str(delivery_line))
self._setDeliveryMovementProperties(
object_to_update, movement, property_dict,
......
......@@ -38,6 +38,8 @@ from Products.ERP5.Document.TransformationSourcingRule import\
from zLOG import LOG
class TransformationRuleError(Exception): pass
class TransformationRule(Rule):
"""
Order Rule object make sure an Order in the similation
......@@ -92,7 +94,7 @@ class TransformationRule(Rule):
elif length > 1:
result = 0
# XXX FIXME: implementation needed
raise "TransformationRuleError",\
raise TransformationRuleError,\
"TransformationRule not able to use multiple SupplyLink."
return result
......@@ -118,7 +120,7 @@ class TransformationRule(Rule):
if len(current_supply_link_list) != 1:
# We shall no pass here.
# The test method returned a wrong value !
raise "TransformationRuleError",\
raise TransformationRuleError,\
"Expand must not be called on %r" %\
applied_rule.getRelativeUrl()
else:
......
......@@ -38,6 +38,9 @@ from Products.ERP5.Document.Rule import Rule
from zLOG import LOG
class ProductionOrderError(Exception): pass
class TransformationSourcingRuleError(Exception): pass
class TransformationSourcingRuleMixin(ExtensionClass.Base):
"""
Mixin class used by TransformationSourcingRule and TransformationRule
......@@ -57,7 +60,7 @@ class TransformationSourcingRuleMixin(ExtensionClass.Base):
supply_chain = order.getSpecialiseValue(
portal_type=supply_chain_portal_type)
if supply_chain is None:
raise "ProductionOrderError",\
raise ProductionOrderError,\
"No SupplyChain defined on %s" % str(order)
else:
return supply_chain
......@@ -197,7 +200,7 @@ class TransformationSourcingRule(Rule):
parent_supply_link,
movement=parent_movement)
if len(previous_supply_link_list) == 0:
raise "TransformationSourcingRuleError",\
raise TransformationSourcingRuleError,\
"Expand must not be called on %r" %\
applied_rule.getRelativeUrl()
else:
......
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