Commit a4537cab authored by Gintautas Miliauskas's avatar Gintautas Miliauskas

This should finally rid ZODB of obsolete zLOG imports. I hope nothing's

processing the messages because the format might have changed a little bit.
parent 149f15c5
This diff is collapsed.
...@@ -13,14 +13,20 @@ ...@@ -13,14 +13,20 @@
############################################################################## ##############################################################################
"""Mounted database support """Mounted database support
$Id: Mount.py,v 1.23 2004/03/04 22:41:50 jim Exp $""" $Id: Mount.py,v 1.24 2004/04/22 21:27:43 gintautasm Exp $"""
__version__='$Revision: 1.23 $'[11:-2] __version__='$Revision: 1.24 $'[11:-2]
import thread, persistent, Acquisition import string
import time
import sys
import thread
import logging
import persistent
import Acquisition
from Acquisition import aq_base from Acquisition import aq_base
import string, time, sys
from POSException import MountedStorageError from POSException import MountedStorageError
from zLOG import LOG, INFO, WARNING
logger = logging.getLogger('zodb.Mount')
# dbs is a holder for all DB objects, needed to overcome # dbs is a holder for all DB objects, needed to overcome
# threading issues. It maps connection params to a DB object # threading issues. It maps connection params to a DB object
...@@ -99,7 +105,7 @@ class MountPoint(persistent.Persistent, Acquisition.Implicit): ...@@ -99,7 +105,7 @@ class MountPoint(persistent.Persistent, Acquisition.Implicit):
params = self._params params = self._params
dbInfo = dbs.get(params, None) dbInfo = dbs.get(params, None)
if dbInfo is None: if dbInfo is None:
LOG('ZODB', INFO, 'Opening database for mounting: %s' % params) logger.info('Opening database for mounting: %s', params)
db = self._createDB() db = self._createDB()
newMount = 1 newMount = 1
dbs[params] = (db, {self.__mountpoint_id:1}) dbs[params] = (db, {self.__mountpoint_id:1})
...@@ -183,8 +189,8 @@ class MountPoint(persistent.Persistent, Acquisition.Implicit): ...@@ -183,8 +189,8 @@ class MountPoint(persistent.Persistent, Acquisition.Implicit):
try: id = data.getId() try: id = data.getId()
except: id = '???' # data has no getId() method. Bad. except: id = '???' # data has no getId() method. Bad.
p = string.join(parent.getPhysicalPath() + (id,), '/') p = string.join(parent.getPhysicalPath() + (id,), '/')
LOG('ZODB', INFO, 'Mounted database %s at %s' % logger.info('Mounted database %s at %s',
(self._getMountParams(), p)) self._getMountParams(), p)
else: else:
data = t[0] data = t[0]
...@@ -229,9 +235,8 @@ class MountPoint(persistent.Persistent, Acquisition.Implicit): ...@@ -229,9 +235,8 @@ class MountPoint(persistent.Persistent, Acquisition.Implicit):
except: except:
from StringIO import StringIO from StringIO import StringIO
import traceback import traceback
exc = sys.exc_info() logger.warning('Failed to mount database. %s (%s)', exc[:2],
LOG('ZODB', WARNING, 'Failed to mount database. %s (%s)' % exc[:2], exc_info=True)
error=exc)
f=StringIO() f=StringIO()
traceback.print_tb(exc[2], 100, f) traceback.print_tb(exc[2], 100, f)
self._v_connect_error = (exc[0], exc[1], f.getvalue()) self._v_connect_error = (exc[0], exc[1], f.getvalue())
...@@ -275,8 +280,10 @@ class MountedConnectionCloser: ...@@ -275,8 +280,10 @@ class MountedConnectionCloser:
del data.__dict__['_v__object_deleted__'] del data.__dict__['_v__object_deleted__']
close_db = 1 close_db = 1
# Close the child connection. # Close the child connection.
try: del conn._mount_parent_jar try:
except: pass del conn._mount_parent_jar
except:
pass
conn.close() conn.close()
if close_db: if close_db:
...@@ -295,6 +302,6 @@ class MountedConnectionCloser: ...@@ -295,6 +302,6 @@ class MountedConnectionCloser:
# No more mount points are using this database. # No more mount points are using this database.
del dbs[params] del dbs[params]
db.close() db.close()
LOG('ZODB', INFO, 'Closed database: %s' % params) logger.info('Closed database: %s', params)
finally: finally:
dblock.release() dblock.release()
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