Commit 8f7e9691 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Selection: Do not set Selections if the new and store name differs instead of...

Selection: Do not set Selections if the new and store name differs instead of raising AssertionError.
parent a1765783
...@@ -46,7 +46,7 @@ import string, re ...@@ -46,7 +46,7 @@ import string, re
from time import time from time import time
from random import random from random import random
from urlparse import urlsplit, urlunsplit from urlparse import urlsplit, urlunsplit
from zLOG import LOG, INFO from zLOG import LOG, INFO, WARNING
from Acquisition import aq_base from Acquisition import aq_base
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
import warnings import warnings
...@@ -284,9 +284,14 @@ class SelectionTool( BaseTool, SimpleItem ): ...@@ -284,9 +284,14 @@ class SelectionTool( BaseTool, SimpleItem ):
if anonymous_uid is not None: if anonymous_uid is not None:
self.REQUEST.response.setCookie('anonymous_uid', anonymous_uid, self.REQUEST.response.setCookie('anonymous_uid', anonymous_uid,
path='/') path='/')
assert selection_object is None or selection_name == selection_object.name
if self.getSelectionFor(selection_name) != selection_object: if not (selection_object is None or
selection_name == selection_object.name):
LOG('SelectionTool', WARNING,
"Selection not set: new Selection name ('%s') differs from existing one ('%s')" % \
(selection_name,
selection_object.name))
elif self.getSelectionFor(selection_name) != selection_object:
self._setSelectionToContainer(selection_name, selection_object) self._setSelectionToContainer(selection_name, selection_object)
security.declareProtected(ERP5Permissions.View, 'getSelectionParamsFor') security.declareProtected(ERP5Permissions.View, 'getSelectionParamsFor')
......
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