Skip to content

Commit

Permalink
Fix a write on read situation
Browse files Browse the repository at this point in the history
  • Loading branch information
gforcada committed Oct 21, 2015
1 parent 08da06a commit 229f5c5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plone/contentrules/engine/assignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from plone.contentrules.engine.interfaces import IRuleAssignment
from plone.contentrules.engine.interfaces import IRuleAssignmentManager

from plone.protect.utils import safeWrite

from BTrees.OOBTree import OOBTree


Expand Down Expand Up @@ -85,6 +87,10 @@ def ruleAssignmentManagerAdapterFactory(context):
annotations = IAnnotations(context)
manager = annotations.get(KEY, None)
if manager is None:
manager = annotations[KEY] = RuleAssignmentManager()
annotations[KEY] = RuleAssignmentManager()
manager = annotations[KEY]
# protect both context and its annotations from a write on read error
safeWrite(context)
safeWrite(context.__annotations__)

return manager

0 comments on commit 229f5c5

Please sign in to comment.