Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102424448
open_zodb.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Feb 20, 14:22
Size
1 KB
Mime Type
text/x-python
Expires
Sat, Feb 22, 14:22 (2 d)
Engine
blob
Format
Raw Data
Handle
24354390
Attached To
R3127 blackdynamite
open_zodb.py
View Options
#!/usr/bin/env python
################################################################
import
transaction
from
traitlets.config
import
get_config
from
IPython
import
embed
import
ZODB
import
ZODB.FileStorage
################################################################
class
Command
:
def
__init__
(
self
,
cmd
):
self
.
cmd
=
cmd
def
__repr__
(
self
):
return
self
.
cmd
()
def
make_command
(
func
):
return
Command
(
func
)
@make_command
def
commit
():
transaction
.
commit
()
return
""
################################################################
if
__name__
==
'__main__'
:
storage
=
ZODB
.
FileStorage
.
FileStorage
(
'.bd/bd.zeo'
,
blob_dir
=
'.bd/blob_data'
)
db
=
ZODB
.
DB
(
storage
)
connection
=
db
.
open
()
root
=
connection
.
root
c
=
get_config
()
c
.
InteractiveShellEmbed
.
colors
=
"Linux"
embed
(
config
=
c
,
banner1
=
"""
Your database is accessible as the object 'db'.
Your root is accessible in the object 'root'.
For any changes you do you should hit 'commit' to make them permanent
"""
)
Event Timeline
Log In to Comment