Commit 7f49a29f authored by Jim Fulton's avatar Jim Fulton

Renamed the _classFactory attribute to classFactory.

parent 37d0cf64
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
############################################################################## ##############################################################################
"""Database connection support """Database connection support
$Id: Connection.py,v 1.135 2004/03/04 19:48:03 jeremy Exp $""" $Id: Connection.py,v 1.136 2004/03/04 22:41:50 jim Exp $"""
import logging import logging
import sys import sys
...@@ -125,7 +125,7 @@ class Connection(ExportImport, object): ...@@ -125,7 +125,7 @@ class Connection(ExportImport, object):
their state and register changes. The methods are setstate(), their state and register changes. The methods are setstate(),
register(), setklassstate(). register(), setklassstate().
$Id: Connection.py,v 1.135 2004/03/04 19:48:03 jeremy Exp $ $Id: Connection.py,v 1.136 2004/03/04 22:41:50 jim Exp $
""" """
_tmp = None _tmp = None
...@@ -348,7 +348,7 @@ class Connection(ExportImport, object): ...@@ -348,7 +348,7 @@ class Connection(ExportImport, object):
else: else:
self._flush_invalidations() self._flush_invalidations()
self._reader = ConnectionObjectReader(self, self._cache, self._reader = ConnectionObjectReader(self, self._cache,
self._db._classFactory) self._db.classFactory)
self._opened = time() self._opened = time()
def _resetCache(self): def _resetCache(self):
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
############################################################################## ##############################################################################
"""Database objects """Database objects
$Id: DB.py,v 1.69 2004/03/04 19:48:04 jeremy Exp $""" $Id: DB.py,v 1.70 2004/03/04 22:41:50 jim Exp $"""
import cPickle, cStringIO, sys import cPickle, cStringIO, sys
from thread import allocate_lock from thread import allocate_lock
...@@ -45,9 +45,8 @@ class DB(object): ...@@ -45,9 +45,8 @@ class DB(object):
it to provide a different connection implementation. it to provide a different connection implementation.
The database provides a few methods intended for application code The database provides a few methods intended for application code
-- open, close, undo, pack, setClassFactory -- and a large -- open, close, undo, and pack -- and a large collection of
collection of methods for inspecting the database and its connections' methods for inspecting the database and its connections' caches.
caches.
""" """
klass = Connection # Class to use for connections klass = Connection # Class to use for connections
...@@ -142,9 +141,6 @@ class DB(object): ...@@ -142,9 +141,6 @@ class DB(object):
else: m=None else: m=None
return m return m
def _classFactory(self, connection, modulename, globalname):
return find_global(modulename, globalname)
def _closeConnection(self, connection): def _closeConnection(self, connection):
"""Return a connection to the pool""" """Return a connection to the pool"""
self._a() self._a()
...@@ -574,19 +570,8 @@ class DB(object): ...@@ -574,19 +570,8 @@ class DB(object):
for c in pool_info[1]: for c in pool_info[1]:
c._cache.cache_size = v c._cache.cache_size = v
def setClassFactory(self, factory): def classFactory(self, connection, modulename, globalname):
"""Override default mechanism for loading object classes. return find_global(modulename, globalname)
The database stores objects, but uses Python's standard import
to load the code for those objects. The class factory is used
by the database serialization layer to find the classes. It
uses ZODB.broken.find_global by default.
This method can be used to override the default class loading
code. See ZODB.broken.find_global for details
about the contract of factory.
"""
self._classFactory = factory
def setPoolSize(self, v): def setPoolSize(self, v):
self._pool_size=v self._pool_size=v
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
############################################################################## ##############################################################################
"""Mounted database support """Mounted database support
$Id: Mount.py,v 1.22 2004/02/27 00:31:53 faassen Exp $""" $Id: Mount.py,v 1.23 2004/03/04 22:41:50 jim Exp $"""
__version__='$Revision: 1.22 $'[11:-2] __version__='$Revision: 1.23 $'[11:-2]
import thread, persistent, Acquisition import thread, persistent, Acquisition
from Acquisition import aq_base from Acquisition import aq_base
...@@ -41,7 +41,7 @@ def parentClassFactory(jar, module, name): ...@@ -41,7 +41,7 @@ def parentClassFactory(jar, module, name):
return getattr(__import__( return getattr(__import__(
module, _globals, _globals, _silly), name) module, _globals, _globals, _silly), name)
else: else:
return parent_db._classFactory(parent_conn, module, name) return parent_db.classFactory(parent_conn, module, name)
class MountPoint(persistent.Persistent, Acquisition.Implicit): class MountPoint(persistent.Persistent, Acquisition.Implicit):
...@@ -105,7 +105,7 @@ class MountPoint(persistent.Persistent, Acquisition.Implicit): ...@@ -105,7 +105,7 @@ class MountPoint(persistent.Persistent, Acquisition.Implicit):
dbs[params] = (db, {self.__mountpoint_id:1}) dbs[params] = (db, {self.__mountpoint_id:1})
if getattr(self, '_classDefsFromRoot', 1): if getattr(self, '_classDefsFromRoot', 1):
db.setClassFactory(parentClassFactory) db.classFactory = parentClassFactory
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.
......
...@@ -569,7 +569,7 @@ class StubDatabase: ...@@ -569,7 +569,7 @@ class StubDatabase:
def __init__(self): def __init__(self):
self._storage = StubStorage() self._storage = StubStorage()
_classFactory = None classFactory = None
def invalidate(self, transaction, dict_with_oid_keys, connection): def invalidate(self, transaction, dict_with_oid_keys, connection):
pass pass
......
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