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