diff --git a/product/ERP5/Document/DeliveryBuilder.py b/product/ERP5/Document/DeliveryBuilder.py index 791ac989d05c7a524d87b794a5459004046300a0..68143449a260a3e12aef4ac9f8372a9ac5f70f64 100755 --- a/product/ERP5/Document/DeliveryBuilder.py +++ b/product/ERP5/Document/DeliveryBuilder.py @@ -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 diff --git a/product/ERP5/Document/OrderBuilder.py b/product/ERP5/Document/OrderBuilder.py index 31cae8e478c5f1c4cfecb3445fbc9e19df6bb171..651a5714c09a216ca7c84becf84351711c52a5b7 100755 --- a/product/ERP5/Document/OrderBuilder.py +++ b/product/ERP5/Document/OrderBuilder.py @@ -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, diff --git a/product/ERP5/Document/TransformationRule.py b/product/ERP5/Document/TransformationRule.py index 11adc9a0f66aeddb4bdfef5c6f30735608eba794..49754f5ffb687f57d9857974957daf41e48cda44 100755 --- a/product/ERP5/Document/TransformationRule.py +++ b/product/ERP5/Document/TransformationRule.py @@ -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: diff --git a/product/ERP5/Document/TransformationSourcingRule.py b/product/ERP5/Document/TransformationSourcingRule.py index 98324c7ce0533013ec7b8c78785d8ca356b5b169..a23beb3142cdd153b30aacff85c33655f3cd9323 100755 --- a/product/ERP5/Document/TransformationSourcingRule.py +++ b/product/ERP5/Document/TransformationSourcingRule.py @@ -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: