Commit 9234240b authored by Shane Hathaway's avatar Shane Hathaway

Same as 2_5 branch.

parent 8aaebe82
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
############################################################################## ##############################################################################
"""Mounted database support """Mounted database support
$Id: Mount.py,v 1.12 2001/12/04 23:04:14 shane Exp $""" $Id: Mount.py,v 1.13 2001/12/05 16:45:58 shane Exp $"""
__version__='$Revision: 1.12 $'[11:-2] __version__='$Revision: 1.13 $'[11:-2]
import thread, Persistence, Acquisition import thread, Persistence, Acquisition
import ExtensionClass, string, time, sys import ExtensionClass, string, time, sys
...@@ -28,20 +28,18 @@ dbs = {} ...@@ -28,20 +28,18 @@ dbs = {}
# dblock is locked every time dbs is accessed. # dblock is locked every time dbs is accessed.
dblock=thread.allocate_lock() dblock=thread.allocate_lock()
try:
# Make special provisions for ZClasses if we're in a Zope
# installation.
from Zope.ClassFactory import ClassFactory
def RootDefsClassFactory(jar, module, name): def parentClassFactory(jar, module, name):
# Use the class definitions given at # Use the class factory from the parent database.
# the root of the Zope installation. parent_db = getattr(getattr(jar, '_mount_parent_jar', None),
while hasattr(jar, '_mount_parent_jar'): '_db', None)
jar = jar._mount_parent_jar if parent_db is None:
return ClassFactory(jar, module, name) _globals = {}
except: _silly = ('__doc__',)
ClassFactory = None return getattr(__import__(
RootDefsClassFactory = None module, _globals, _globals, _silly), name)
else:
return parent_db._classFactory(jar, module, name)
class MountPoint(Persistence.Persistent, Acquisition.Implicit): class MountPoint(Persistence.Persistent, Acquisition.Implicit):
...@@ -104,11 +102,8 @@ class MountPoint(Persistence.Persistent, Acquisition.Implicit): ...@@ -104,11 +102,8 @@ class MountPoint(Persistence.Persistent, Acquisition.Implicit):
newMount = 1 newMount = 1
dbs[params] = (db, {self.__mountpoint_id:1}) dbs[params] = (db, {self.__mountpoint_id:1})
if RootDefsClassFactory is not None and \ if getattr(self, '_classDefsFromRoot', 1):
getattr(self, '_classDefsFromRoot', 1): db.setClassFactory(parentClassFactory)
db.setClassFactory(RootDefsClassFactory)
elif ClassFactory is not None:
db.setClassFactory(ClassFactory)
else: else:
db, mounts = dbInfo db, mounts = dbInfo
# Be sure this object is in the list of mount points. # Be sure this object is in the list of mount points.
......
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