Skip to content

Instantly share code, notes, and snippets.

@tseaver
Created June 7, 2013 01:13
Show Gist options
  • Save tseaver/5726422 to your computer and use it in GitHub Desktop.
Save tseaver/5726422 to your computer and use it in GitHub Desktop.
Show how trunk ZODB creates unpicklable objects on Py3k.
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