Commit 969d5560 authored by Julien Muchembled's avatar Julien Muchembled

Fix Delivery_updateAppliedRule on Zope 2.12

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40005 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 930217b0
......@@ -50,7 +50,9 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>delivery = context\n
<value> <string>from Products.ERP5Type.Errors import SimulationError\n
\n
delivery = context\n
delivery_type = context.getPortalType()\n
\n
# XXX The following dict is only for backward compatibility.\n
......@@ -80,7 +82,7 @@ applied_rule_dict = {\n
\n
try:\n
applied_rule = delivery.getRuleReference()\n
except \'SimulationError\':\n
except SimulationError:\n
marker = []\n
applied_rule = applied_rule_dict.get(delivery_type, marker)\n
if applied_rule is marker:\n
......@@ -133,6 +135,8 @@ elif applied_rule:\n
<tuple>
<string>activate_kw</string>
<string>kw</string>
<string>Products.ERP5Type.Errors</string>
<string>SimulationError</string>
<string>context</string>
<string>delivery</string>
<string>_getattr_</string>
......
894
\ No newline at end of file
895
\ No newline at end of file
......@@ -34,6 +34,7 @@ from Products.CMFCore.utils import getToolByName
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
from Products.ERP5Type.Errors import SimulationError
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5.Document.ImmobilisationDelivery import ImmobilisationDelivery
from Products.ERP5.mixin.amount_generator import AmountGeneratorMixin
......@@ -765,8 +766,8 @@ class Delivery(XMLObject, ImmobilisationDelivery,
# Re expand the rule if possible
my_applied_rule = my_applied_rule_list[0]
else:
raise "SimulationError", 'Delivery %s has more than one applied'\
' rule.' % self.getRelativeUrl()
raise SimulationError('Delivery %s has more than one applied'
' rule.' % self.getRelativeUrl())
my_applied_rule_id = None
expand_activate_kw = {}
......@@ -917,8 +918,8 @@ class Delivery(XMLObject, ImmobilisationDelivery,
if method is not None:
return method()
else:
raise 'SimulationError', '%s_getRuleReference script is missing.' \
% self.getPortalType().replace(' ', '')
raise SimulationError('%s_getRuleReference script is missing.'
% self.getPortalType().replace(' ', ''))
security.declareProtected( Permissions.AccessContentsInformation,
'getRootSpecialiseValue')
......
......@@ -32,6 +32,7 @@ from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import getToolByName
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.Errors import SimulationError
from Products.ERP5.Document.Item import Item
from Products.ERP5.mixin.rule import MovementGeneratorMixin
from Products.ERP5.mixin.periodicity import PeriodicityMixin
......@@ -119,8 +120,8 @@ class SubscriptionItem(Item, MovementGeneratorMixin, PeriodicityMixin):
rule_value_list = portal_rules.searchRuleList(self,
tested_base_category_list=tested_base_category_list)
if len(rule_value_list) > 1:
raise "SimulationError", 'Expandable Document %s has more than one matching'\
' rule.' % self.getRelativeUrl()
raise SimulationError('Expandable Document %s has more than one'
' matching rule.' % self.getRelativeUrl())
if len(rule_value_list):
rule_value = rule_value_list[0]
my_applied_rule = rule_value.constructNewAppliedRule(portal_simulation,
......@@ -134,8 +135,8 @@ class SubscriptionItem(Item, MovementGeneratorMixin, PeriodicityMixin):
# Re expand the rule if possible
my_applied_rule = my_applied_rule_list[0]
else:
raise "SimulationError", 'Expandable Document %s has more than one root applied'\
' rule.' % self.getRelativeUrl()
raise SimulationError('Expandable Document %s has more than one root'
' applied rule.' % self.getRelativeUrl())
return my_applied_rule
......
......@@ -42,6 +42,7 @@ class UnsupportedWorkflowMethod(WorkflowException):
class ImmobilisationValidityError(Exception):pass
class ImmobilisationCalculationError(Exception):pass
class TransformationRuleError(Exception):pass
class SimulationError(Exception):pass
allow_class(DeferredCatalogError)
......@@ -51,3 +52,4 @@ allow_class(ImmobilisationCalculationError)
allow_class(WorkflowException)
allow_class(UnsupportedWorkflowMethod)
allow_class(TransformationRuleError)
allow_class(SimulationError)
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