Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZEO
Commits
75152486
Commit
75152486
authored
Feb 25, 2004
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add deprecation warning for register() call with _p_oid is None.
parent
b7b5bfb0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
src/ZODB/Connection.py
src/ZODB/Connection.py
+18
-4
No files found.
src/ZODB/Connection.py
View file @
75152486
...
...
@@ -13,12 +13,13 @@
##############################################################################
"""Database connection support
$Id: Connection.py,v 1.12
3 2004/02/25 11:30:16 jim
Exp $"""
$Id: Connection.py,v 1.12
4 2004/02/25 19:09:14 jeremy
Exp $"""
import
logging
import
sys
import
threading
import
itertools
import
warnings
from
time
import
time
from
utils
import
u64
...
...
@@ -84,10 +85,13 @@ class Connection(ExportImport, object):
connection or the transaction the connection is registered with,
the application should provide locking.
The Connection manages movement of objects in and out of object
storage.
XXX We should document an intended API for using a Connection via
multiple threads.
$Id: Connection.py,v 1.12
3 2004/02/25 11:30:16 jim
Exp $
$Id: Connection.py,v 1.12
4 2004/02/25 19:09:14 jeremy
Exp $
"""
_tmp
=
None
...
...
@@ -210,6 +214,7 @@ class Connection(ExportImport, object):
raise
TypeError
(
"Only first-class persistent objects may be"
" added to a Connection."
,
obj
)
elif
obj
.
_p_jar
is
None
:
assert
obj
.
_p_oid
is
None
oid
=
obj
.
_p_oid
=
self
.
_storage
.
new_oid
()
obj
.
_p_jar
=
self
self
.
_added
[
oid
]
=
obj
...
...
@@ -496,8 +501,17 @@ class Connection(ExportImport, object):
policy of one transaction manager for each thread.
"""
assert
object
.
_p_jar
is
self
# XXX Figure out why this assert causes test failures
#assert object._p_oid is not None
if
object
.
_p_oid
is
not
None
:
# There is some old Zope code that assigns _p_jar
# directly. That is no longer allowed, but we need to
# provide support for old code that still does it.
# XXX The actual complaint here is that an object without
# an oid is being registered. I can't think of any way to
# achieve that without assignment to _p_jar. If there is
# a way, this will be a very confusing warning.
warnings
.
warn
(
"Assigning to _p_jar is deprecated"
,
PendingDeprecationWarning
)
self
.
getTransaction
().
register
(
object
)
def
root
(
self
):
...
...
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