cybertools/z2/intid/unreferenceable.py
helmutm d1110c410e include slightly modified copy of five.intid
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3685 fd906abe-77d9-0310-91a1-e0d9ade77398
2010-01-14 12:12:30 +00:00

31 lines
910 B
Python

# Sometimes persistent classes are never meant to be persisted. The most
# common example are CMFCore directory views and filesystem objects.
# Register specific handlers that are no-ops to circumvent
from zope.interface import implements
from zope.app.keyreference.interfaces import IKeyReference, NotYet
def addIntIdSubscriber(ob, event):
return
def removeIntIdSubscriber(ob, event):
return
def moveIntIdSubscriber(ob, event):
return
class KeyReferenceNever(object):
"""A keyreference that is never ready"""
implements(IKeyReference)
key_type_id = 'five.intid.cmfexceptions.keyreference'
def __init__(self, obj):
raise NotYet()
def __call__(self):
return None
def __cmp__(self, other):
if self.key_type_id == other.key_type_id:
return cmp(self, other)
return cmp(self.key_type_id, other.key_type_id)