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
4e826256
Commit
4e826256
authored
Jan 08, 2010
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged the hannosch-ibroken branch which provides an interface for
broken objects.
parent
f0dc0114
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
0 deletions
+43
-0
src/CHANGES.txt
src/CHANGES.txt
+5
-0
src/ZODB/broken.py
src/ZODB/broken.py
+6
-0
src/ZODB/interfaces.py
src/ZODB/interfaces.py
+26
-0
src/ZODB/tests/testBroken.py
src/ZODB/tests/testBroken.py
+6
-0
No files found.
src/CHANGES.txt
View file @
4e826256
...
@@ -5,6 +5,11 @@
...
@@ -5,6 +5,11 @@
3.10.0a1 (2009-12-??)
3.10.0a1 (2009-12-??)
=====================
=====================
New Features
------------
- Broken objects now provide the IBroken interface.
Bugs Fixed
Bugs Fixed
----------
----------
...
...
src/ZODB/broken.py
View file @
4e826256
...
@@ -19,6 +19,10 @@ $Id$
...
@@ -19,6 +19,10 @@ $Id$
import
sys
import
sys
import
persistent
import
persistent
import
zope.interface
import
ZODB.interfaces
broken_cache
=
{}
broken_cache
=
{}
class
Broken
(
object
):
class
Broken
(
object
):
...
@@ -92,6 +96,8 @@ class Broken(object):
...
@@ -92,6 +96,8 @@ class Broken(object):
>>> broken_cache.clear()
>>> broken_cache.clear()
"""
"""
zope
.
interface
.
implements
(
ZODB
.
interfaces
.
IBroken
)
__Broken_state__
=
__Broken_initargs__
=
None
__Broken_state__
=
__Broken_initargs__
=
None
__name__
=
'broken object'
__name__
=
'broken object'
...
...
src/ZODB/interfaces.py
View file @
4e826256
...
@@ -1217,6 +1217,32 @@ class IBlobStorageRestoreable(IBlobStorage, IStorageRestoreable):
...
@@ -1217,6 +1217,32 @@ class IBlobStorageRestoreable(IBlobStorage, IStorageRestoreable):
"""
"""
class
IBroken
(
Interface
):
"""Broken objects are placeholders for objects that can no longer be
created because their class has gone away.
They cannot be modified, but they retain their state. This allows them to
be rebuild should the missing class be found again.
A broken object's __class__ can be used to determine the original
class' name (__name__) and module (__module__).
The original object's state and initialization arguments are
available in broken object attributes to aid analysis and
reconstruction.
"""
def
__setattr__
(
name
,
value
):
"""You cannot modify broken objects. This will raise a
ZODB.broken.BrokenModified exception.
"""
__Broken_newargs__
=
Attribute
(
"Arguments passed to __new__."
)
__Broken_initargs__
=
Attribute
(
"Arguments passed to __init__."
)
__Broken_state__
=
Attribute
(
"Value passed to __setstate__."
)
class
BlobError
(
Exception
):
class
BlobError
(
Exception
):
pass
pass
...
...
src/ZODB/tests/testBroken.py
View file @
4e826256
...
@@ -71,6 +71,12 @@ def test_integration():
...
@@ -71,6 +71,12 @@ def test_integration():
>>> a3.__Broken_state__
>>> a3.__Broken_state__
{'x': 1}
{'x': 1}
Broken objects provide an interface:
>>> from ZODB.interfaces import IBroken
>>> IBroken.providedBy(a3)
True
Let's clean up:
Let's clean up:
>>> db.close()
>>> db.close()
...
...
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