Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZODB
Commits
8e59b888
Commit
8e59b888
authored
Jan 09, 2002
by
Brian Lloyd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged '__module__' dependency fix from Zope 2.5 branch.
parent
0a2fbddf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
20 deletions
+19
-20
src/ZODB/DB.py
src/ZODB/DB.py
+19
-20
No files found.
src/ZODB/DB.py
View file @
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.3
6 2001/11/28 15:51:18 matt
Exp $"""
$Id: DB.py,v 1.3
7 2002/01/09 18:54:20 Brian
Exp $"""
__version__
=
'$Revision: 1.3
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
7
$'
[
11
:
-
2
]
import
cPickle
,
cStringIO
,
sys
,
POSException
,
UndoLogCompatible
import
cPickle
,
cStringIO
,
sys
,
POSException
,
UndoLogCompatible
from
Connection
import
Connection
from
Connection
import
Connection
...
@@ -72,20 +72,15 @@ class DB(UndoLogCompatible.UndoLogCompatible):
...
@@ -72,20 +72,15 @@ 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
:
try
:
storage
.
load
(
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
,
''
)
storage
.
load
(
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
,
''
)
except
:
except
KeyError
:
# Create the database's root in the storage if it doesn't exist
import
PersistentMapping
import
PersistentMapping
root
=
PersistentMapping
.
PersistentMapping
()
file
=
cStringIO
.
StringIO
()
# Manually create a pickle for the root to put in the storage.
p
=
cPickle
.
Pickler
(
file
,
1
)
# The pickle must be in the special ZODB format.
p
.
dump
((
PersistentMapping
.
PersistentMapping
,
None
))
file
=
cStringIO
.
StringIO
()
p
.
dump
({
'_container'
:
{}})
p
=
cPickle
.
Pickler
(
file
,
1
)
t
=
Transaction
()
p
.
dump
((
root
.
__class__
,
None
))
t
.
description
=
'initial database creation'
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
)
...
@@ -159,7 +154,9 @@ class DB(UndoLogCompatible.UndoLogCompatible):
...
@@ -159,7 +154,9 @@ class DB(UndoLogCompatible.UndoLogCompatible):
detail
=
{}
detail
=
{}
def
f
(
con
,
detail
=
detail
,
have_detail
=
detail
.
has_key
):
def
f
(
con
,
detail
=
detail
,
have_detail
=
detail
.
has_key
):
for
oid
,
ob
in
con
.
_cache
.
items
():
for
oid
,
ob
in
con
.
_cache
.
items
():
c
=
"%s.%s"
%
(
ob
.
__class__
.
__module__
,
ob
.
__class__
.
__name__
)
module
=
getattr
(
ob
.
__class__
,
'__module__'
,
''
)
module
=
module
and
'%s.'
%
module
or
''
c
=
"%s%s"
%
(
module
,
ob
.
__class__
.
__name__
)
if
have_detail
(
c
):
detail
[
c
]
=
detail
[
c
]
+
1
if
have_detail
(
c
):
detail
[
c
]
=
detail
[
c
]
+
1
else
:
detail
[
c
]
=
1
else
:
detail
[
c
]
=
1
...
@@ -182,13 +179,15 @@ class DB(UndoLogCompatible.UndoLogCompatible):
...
@@ -182,13 +179,15 @@ class DB(UndoLogCompatible.UndoLogCompatible):
id
=
d
[
'id'
]
id
=
d
[
'id'
]
elif
d
.
has_key
(
'__name__'
):
elif
d
.
has_key
(
'__name__'
):
id
=
d
[
'__name__'
]
id
=
d
[
'__name__'
]
module
=
getattr
(
ob
.
__class__
,
'__module__'
,
''
)
module
=
module
and
'%s.'
%
module
or
''
detail
.
append
({
detail
.
append
({
'conn_no'
:
cn
,
'conn_no'
:
cn
,
'oid'
:
oid
,
'oid'
:
oid
,
'id'
:
id
,
'id'
:
id
,
'klass'
:
"%s.%s"
%
(
ob
.
__class__
.
__module__
,
'klass'
:
"%s%s"
%
(
module
,
ob
.
__class__
.
__name__
),
ob
.
__class__
.
__name__
),
'rc'
:
rc
(
ob
)
-
4
,
'rc'
:
rc
(
ob
)
-
4
,
'state'
:
ob
.
_p_changed
,
'state'
:
ob
.
_p_changed
,
#'references': con.references(oid),
#'references': con.references(oid),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment