Commit 98eb0f1e authored by Brian Lloyd's avatar Brian Lloyd

Fixed a lost update from the __module__ merge.

parent 8e59b888
############################################################################## ##############################################################################
# #
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved. # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
# #
# This software is subject to the provisions of the Zope Public License, # This software is subject to the provisions of the Zope Public License,
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
############################################################################## ##############################################################################
"""Database objects """Database objects
$Id: DB.py,v 1.37 2002/01/09 18:54:20 Brian Exp $""" $Id: DB.py,v 1.38 2002/01/09 19:15:31 Brian Exp $"""
__version__='$Revision: 1.37 $'[11:-2] __version__='$Revision: 1.38 $'[11:-2]
import cPickle, cStringIO, sys, POSException, UndoLogCompatible import cPickle, cStringIO, sys, POSException, UndoLogCompatible
from Connection import Connection from Connection import Connection
...@@ -72,15 +72,20 @@ class DB(UndoLogCompatible.UndoLogCompatible): ...@@ -72,15 +72,20 @@ class DB(UndoLogCompatible.UndoLogCompatible):
self._storage=storage self._storage=storage
storage.registerDB(self, None) storage.registerDB(self, None)
if not hasattr(storage,'tpc_vote'): storage.tpc_vote=lambda *args: None if not hasattr(storage,'tpc_vote'): storage.tpc_vote=lambda *args: None
try: storage.load('\0\0\0\0\0\0\0\0','') try:
except: storage.load('\0\0\0\0\0\0\0\0','')
except KeyError:
# Create the database's root in the storage if it doesn't exist
import PersistentMapping import PersistentMapping
file=cStringIO.StringIO() root = PersistentMapping.PersistentMapping()
p=cPickle.Pickler(file,1) # Manually create a pickle for the root to put in the storage.
p.dump((PersistentMapping.PersistentMapping,None)) # The pickle must be in the special ZODB format.
p.dump({'_container': {}}) file = cStringIO.StringIO()
t=Transaction() p = cPickle.Pickler(file, 1)
t.description='initial database creation' p.dump((root.__class__, None))
p.dump(root.__getstate__())
t = Transaction()
t.description = 'initial database creation'
storage.tpc_begin(t) storage.tpc_begin(t)
storage.store('\0\0\0\0\0\0\0\0', None, file.getvalue(), '', t) storage.store('\0\0\0\0\0\0\0\0', None, file.getvalue(), '', t)
storage.tpc_vote(t) storage.tpc_vote(t)
...@@ -182,7 +187,7 @@ class DB(UndoLogCompatible.UndoLogCompatible): ...@@ -182,7 +187,7 @@ class DB(UndoLogCompatible.UndoLogCompatible):
module = getattr(ob.__class__, '__module__', '') module = getattr(ob.__class__, '__module__', '')
module = module and '%s.' % module or '' module = module and '%s.' % module or ''
detail.append({ detail.append({
'conn_no': cn, 'conn_no': cn,
'oid': oid, 'oid': oid,
......
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