Committing sample files for editing the db.
This commit is contained in:
21
examples/misc/edit-config.py
Normal file
21
examples/misc/edit-config.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import ZODB, ZODB.FileStorage, transaction
|
||||||
|
from BTrees.OOBTree import OOBTree
|
||||||
|
import persistent
|
||||||
|
import persistent.list
|
||||||
|
import transaction
|
||||||
|
import sys
|
||||||
|
import ZEO
|
||||||
|
|
||||||
|
def all_done():
|
||||||
|
transaction.commit()
|
||||||
|
c.close()
|
||||||
|
db.close()
|
||||||
|
sys.exit(0)
|
||||||
|
# storage.close()
|
||||||
|
|
||||||
|
port = int(sys.argv[1])
|
||||||
|
#storage = ZODB.FileStorage.FileStorage('/home/alienhunter/.packetserver/data.zopedb')
|
||||||
|
db = ZEO.DB(('127.0.0.1',port))
|
||||||
|
c = db.open()
|
||||||
|
print("Transaction manager is 'c' variable. Call all_done() before quitting after making any changes.")
|
||||||
|
|
||||||
22
examples/misc/edit-storage-no-zeo.py
Normal file
22
examples/misc/edit-storage-no-zeo.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import ZODB, ZODB.FileStorage, transaction
|
||||||
|
from BTrees.OOBTree import OOBTree
|
||||||
|
import persistent
|
||||||
|
import persistent.list
|
||||||
|
import transaction
|
||||||
|
import sys
|
||||||
|
import ZEO
|
||||||
|
|
||||||
|
def all_done():
|
||||||
|
transaction.commit()
|
||||||
|
c.close()
|
||||||
|
db.close()
|
||||||
|
sys.exit(0)
|
||||||
|
storage.close()
|
||||||
|
|
||||||
|
#port = int(sys.argv[1])
|
||||||
|
storage = ZODB.FileStorage.FileStorage('/home/alienhunter/.packetserver/data.zopedb')
|
||||||
|
#db = ZEO.DB(('127.0.0.1',port))
|
||||||
|
db = ZODB.DB(storage)
|
||||||
|
c = db.open()
|
||||||
|
print("Transaction manager is 'c' variable. Call all_done() before quitting after making any changes.")
|
||||||
|
|
||||||
Reference in New Issue
Block a user