Created
June 7, 2013 01:13
-
-
Save tseaver/5726422 to your computer and use it in GitHub Desktop.
Show how trunk ZODB creates unpicklable objects on Py3k.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
from BTrees.OOBTree import OOBTree | |
import transaction | |
from ZODB import DB | |
WORKING = datetime(5375, 12, 31, 23, 59, 59) | |
FAILING = datetime(5376, 12, 31, 23, 59, 59) | |
LASTONE = datetime(9999, 12, 31, 23, 59, 59) | |
def before(): | |
db = DB('Data.fs') | |
conn = db.open() | |
root = conn.root() | |
tree = root['tree'] = OOBTree() | |
tree[WORKING] = 'working' | |
tree[FAILING] = 'failing' | |
tree[LASTONE] = 'latest' | |
transaction.commit() | |
conn.close() | |
db.close() | |
def after(): | |
db = DB('Data.fs') | |
conn = db.open() | |
root = conn.root() | |
tree = root['tree'] | |
print(tree[WORKING]) | |
print(tree[FAILING]) | |
print(tree[LASTONE]) | |
conn.close() | |
db.close() | |
if __name__ == '__main__': | |
before() | |
after() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment