Commit b25b9532 authored by wenjie.zheng's avatar wenjie.zheng Committed by Sebastien Robin

Base.py: revert unused modifications added during development.

parent 04773db1
...@@ -105,7 +105,6 @@ import zope.interface ...@@ -105,7 +105,6 @@ import zope.interface
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
from zLOG import LOG, INFO, ERROR, WARNING from zLOG import LOG, INFO, ERROR, WARNING
_MARKER = [] _MARKER = []
global registered_workflow_method_set global registered_workflow_method_set
...@@ -169,6 +168,7 @@ class WorkflowMethod(Method): ...@@ -169,6 +168,7 @@ class WorkflowMethod(Method):
# thread variable which tells in which semantic context the code # thread variable which tells in which semantic context the code
# should be executed. - XXX # should be executed. - XXX
return self._m(instance, *args, **kw) return self._m(instance, *args, **kw)
# New implementation does not use any longer wrapWorkflowMethod # New implementation does not use any longer wrapWorkflowMethod
# but directly calls the workflow methods # but directly calls the workflow methods
try: try:
...@@ -211,11 +211,10 @@ class WorkflowMethod(Method): ...@@ -211,11 +211,10 @@ class WorkflowMethod(Method):
# An interaction is ignored if the guard prevents execution. # An interaction is ignored if the guard prevents execution.
# Otherwise, an exception is raised if the workflow transition does not # Otherwise, an exception is raised if the workflow transition does not
# exist from the current state, or if the guard rejects it. # exist from the current state, or if the guard rejects it.
valid_transition_item_list = [] valid_transition_item_list = []
for wf_id, transition_list in candidate_transition_item_list: for wf_id, transition_list in candidate_transition_item_list:
valid_list = []
candidate_workflow = wf[wf_id] candidate_workflow = wf[wf_id]
valid_list = []
for transition_id in transition_list: for transition_id in transition_list:
if candidate_workflow.isWorkflowMethodSupported(instance, transition_id): if candidate_workflow.isWorkflowMethodSupported(instance, transition_id):
valid_list.append(transition_id) valid_list.append(transition_id)
...@@ -262,10 +261,12 @@ class WorkflowMethod(Method): ...@@ -262,10 +261,12 @@ class WorkflowMethod(Method):
# Return result finally # Return result finally
return result return result
# Interactions should not be disabled during normal operation. Only in very # Interactions should not be disabled during normal operation. Only in very
# rare and specific cases like data migration. That's why it is implemented # rare and specific cases like data migration. That's why it is implemented
# with temporary monkey-patching, instead of slowing down __call__ with yet # with temporary monkey-patching, instead of slowing down __call__ with yet
# another condition. # another condition.
_do_interaction = __call__ _do_interaction = __call__
_no_interaction_lock = threading.Lock() _no_interaction_lock = threading.Lock()
_no_interaction_log = None _no_interaction_log = None
...@@ -2235,7 +2236,7 @@ class Base( CopyContainer, ...@@ -2235,7 +2236,7 @@ class Base( CopyContainer,
return self.getId() return self.getId()
security.declareProtected(Permissions.AccessContentsInformation, 'Title' ) security.declareProtected(Permissions.AccessContentsInformation, 'Title' )
Title = getTitleOrId Title = getTitleOrId # Why ???
# CMF Compatibility # CMF Compatibility
security.declareProtected(Permissions.AccessContentsInformation, 'title_or_id' ) security.declareProtected(Permissions.AccessContentsInformation, 'title_or_id' )
...@@ -2324,6 +2325,7 @@ class Base( CopyContainer, ...@@ -2324,6 +2325,7 @@ class Base( CopyContainer,
property_dict[k] = user_dict[k] property_dict[k] = user_dict[k]
return property_dict return property_dict
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getTranslatedId') 'getTranslatedId')
def getTranslatedId(self): def getTranslatedId(self):
...@@ -3206,7 +3208,12 @@ class Base( CopyContainer, ...@@ -3206,7 +3208,12 @@ class Base( CopyContainer,
security.declareProtected(Permissions.ManagePortal, security.declareProtected(Permissions.ManagePortal,
'updateRoleMappingsFor') 'updateRoleMappingsFor')
def updateRoleMappingsFor(self, wf_id, **kw): def updateRoleMappingsFor(self, wf_id, **kw):
"""
Update security policy according to workflow settings given by wf_id
There's no check that the document is actually chained to the workflow,
it's caller responsability to perform this check.
"""
workflow = self.portal_workflow.getWorkflowById(wf_id) workflow = self.portal_workflow.getWorkflowById(wf_id)
if workflow is not None: if workflow is not None:
changed = workflow.updateRoleMappingsFor(self) changed = workflow.updateRoleMappingsFor(self)
......
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