Commit a60a8426 authored by Tres Seaver's avatar Tres Seaver

Don't enforce constraint that assigned jar implement IPersistentDataManager.

This makes the pure-Python implementation match the C version.
parent d33e91a2
......@@ -19,10 +19,10 @@ from zope.interface import Attribute
# Allowed values for _p_state
try:
from .cPersistence import GHOST
from .cPersistence import UPTODATE
from .cPersistence import CHANGED
from .cPersistence import STICKY
from persistent.cPersistence import GHOST
from persistent.cPersistence import UPTODATE
from persistent.cPersistence import CHANGED
from persistent.cPersistence import STICKY
except ImportError: #pragma NO COVER
GHOST = -1
UPTODATE = 0
......@@ -169,7 +169,8 @@ class IPersistent(Interface):
_p_jar = Attribute(
"""The data manager for the object.
The data manager implements the IPersistentDataManager interface.
The data manager should implement IPersistentDataManager (note that
this constraint is not enforced).
If there is no data manager, then this is None.
......
......@@ -70,8 +70,6 @@ class Persistent(object):
if self.__jar != value:
raise ValueError('Already assigned a data manager')
else:
if not IPersistentDataManager.providedBy(value):
raise ValueError('Not a data manager: %s' % value)
self.__jar = value
self.__flags = 0
......
......@@ -74,12 +74,6 @@ class _Persistent_Base(object):
inst._p_jar = new_jar
self.assertRaises(ValueError, _test)
def test_assign_p_jar_w_invalid_jar(self):
inst = self._makeOne()
def _test():
inst._p_jar = object()
self.assertRaises(ValueError, _test)
def test_assign_p_jar_w_valid_jar(self):
jar = self._makeJar()
inst = self._makeOne()
......
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