Commit f5364042 authored by Fred Drake's avatar Fred Drake

document _p_invalidate()

parent beacdb4e
...@@ -140,7 +140,8 @@ class IPersistent(Interface): ...@@ -140,7 +140,8 @@ class IPersistent(Interface):
- call _p_deactivate() - call _p_deactivate()
- set _p_changed to None - set _p_changed to None
There is one way to invalidate an object: delete its _p_changed There are two ways to invalidate an object: call the
_p_invalidate() method (preferred) or delete its _p_changed
attribute. This cannot be ignored, and is used when semantics attribute. This cannot be ignored, and is used when semantics
require invalidation. Normally, an invalidated object transitions require invalidation. Normally, an invalidated object transitions
to the ghost state. However, some objects cannot be ghosts. When to the ghost state. However, some objects cannot be ghosts. When
...@@ -226,6 +227,15 @@ class IPersistent(Interface): ...@@ -226,6 +227,15 @@ class IPersistent(Interface):
may choose to keep an object in the saved state. may choose to keep an object in the saved state.
""" """
def _p_invalidate():
"""Invalidate the object.
Invalidate the object. This causes any data to be thrown
away, even if the object is inthe changed state. The object
is moved to the ghost state; further accesses will cause
object data to be reloaded.
"""
class IPersistentNoReadConflicts(IPersistent): class IPersistentNoReadConflicts(IPersistent):
def _p_independent(): def _p_independent():
"""Hook for subclasses to prevent read conflict errors. """Hook for subclasses to prevent read conflict errors.
......
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