View of /PEAK/src/peak/persistence.py
Parent Directory
| Revision Log
Revision:
1108 -
(
download)
(
as text)
Sat May 10 21:29:49 2003 UTC (21 years ago) by
pje
File size: 1133 byte(s)
Farewell, 'zope.interface'. You served us well.
__all__ = [
'Persistent', 'PersistentMetaClass', 'isGhost'
]
# Ugh; this is the one place where relative imports are annoying:
# when you can't turn them off!
from peak.util.imports import importString
import __main__
md = __main__.__dict__
Persistent = importString('persistence:Persistent', md)
PersistentMetaClass = importString('persistence:PersistentMetaClass', md)
GHOST = importString('persistence._persistence:GHOST', md)
IPersistent = importString('persistence.interfaces:IPersistent', md)
IPersistentDataManager = importString(
'persistence.interfaces:IPersistentDataManager', md
)
def isGhost(obj):
return obj._p_state == GHOST
try:
import zope.interface
except ImportError:
# For safety's sake, declare that Persistent implements IPersistent,
# since the '__implements__' attribute it's using is useless if
# 'zope.interface' isn't around.
from peak.interface import instancesProvide
instancesProvide(Persistent, IPersistent)
# XX It's not clear that we should be using GHOST
# XXX do we need simple_new()? What is it for, anyway?