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
af947463
Commit
af947463
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
05ca590e
Changes
4
Hide 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 @
af947463
...
...
@@ -5,6 +5,11 @@
3.10.0a1 (2009-12-??)
=====================
New Features
------------
- Broken objects now provide the IBroken interface.
Bugs Fixed
----------
...
...
src/ZODB/broken.py
View file @
af947463
...
...
@@ -19,6 +19,10 @@ $Id$
import
sys
import
persistent
import
zope.interface
import
ZODB.interfaces
broken_cache
=
{}
class
Broken
(
object
):
...
...
@@ -92,6 +96,8 @@ class Broken(object):
>>> broken_cache.clear()
"""
zope
.
interface
.
implements
(
ZODB
.
interfaces
.
IBroken
)
__Broken_state__
=
__Broken_initargs__
=
None
__name__
=
'broken object'
...
...
src/ZODB/interfaces.py
View file @
af947463
...
...
@@ -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
):
pass
...
...
src/ZODB/tests/testBroken.py
View file @
af947463
...
...
@@ -71,6 +71,12 @@ def test_integration():
>>> a3.__Broken_state__
{'x': 1}
Broken objects provide an interface:
>>> from ZODB.interfaces import IBroken
>>> IBroken.providedBy(a3)
True
Let's clean up:
>>> 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