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

Renamed the _classFactory attribute to classFactory.

parent 37d0cf64
......@@ -13,7 +13,7 @@
##############################################################################
"""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 sys
......@@ -125,7 +125,7 @@ class Connection(ExportImport, object):
their state and register changes. The methods are setstate(),
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
......@@ -348,7 +348,7 @@ class Connection(ExportImport, object):
else:
self._flush_invalidations()
self._reader = ConnectionObjectReader(self, self._cache,
self._db._classFactory)
self._db.classFactory)
self._opened = time()
def _resetCache(self):
......
......@@ -13,7 +13,7 @@
##############################################################################
"""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
from thread import allocate_lock
......@@ -45,9 +45,8 @@ class DB(object):
it to provide a different connection implementation.
The database provides a few methods intended for application code
-- open, close, undo, pack, setClassFactory -- and a large
collection of methods for inspecting the database and its connections'
caches.
-- open, close, undo, and pack -- and a large collection of
methods for inspecting the database and its connections' caches.
"""
klass = Connection # Class to use for connections
......@@ -142,9 +141,6 @@ class DB(object):
else: m=None
return m
def _classFactory(self, connection, modulename, globalname):
return find_global(modulename, globalname)
def _closeConnection(self, connection):
"""Return a connection to the pool"""
self._a()
......@@ -574,19 +570,8 @@ class DB(object):
for c in pool_info[1]:
c._cache.cache_size = v
def setClassFactory(self, factory):
"""Override default mechanism for loading object classes.
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 classFactory(self, connection, modulename, globalname):
return find_global(modulename, globalname)
def setPoolSize(self, v):
self._pool_size=v
......
......@@ -13,8 +13,8 @@
##############################################################################
"""Mounted database support
$Id: Mount.py,v 1.22 2004/02/27 00:31:53 faassen Exp $"""
__version__='$Revision: 1.22 $'[11:-2]
$Id: Mount.py,v 1.23 2004/03/04 22:41:50 jim Exp $"""
__version__='$Revision: 1.23 $'[11:-2]
import thread, persistent, Acquisition
from Acquisition import aq_base
......@@ -41,7 +41,7 @@ def parentClassFactory(jar, module, name):
return getattr(__import__(
module, _globals, _globals, _silly), name)
else:
return parent_db._classFactory(parent_conn, module, name)
return parent_db.classFactory(parent_conn, module, name)
class MountPoint(persistent.Persistent, Acquisition.Implicit):
......@@ -105,7 +105,7 @@ class MountPoint(persistent.Persistent, Acquisition.Implicit):
dbs[params] = (db, {self.__mountpoint_id:1})
if getattr(self, '_classDefsFromRoot', 1):
db.setClassFactory(parentClassFactory)
db.classFactory = parentClassFactory
else:
db, mounts = dbInfo
# Be sure this object is in the list of mount points.
......
......@@ -569,7 +569,7 @@ class StubDatabase:
def __init__(self):
self._storage = StubStorage()
_classFactory = None
classFactory = None
def invalidate(self, transaction, dict_with_oid_keys, connection):
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