get_transaction().commit() seems not to work ?
I seem not to be able to save my data to ZODB, I wonder what I do wrong here: At the python shell:
test() Here it is: ['testme'] {'testme': {'i love tests': [1, 2, 3]}} ... and now its empty ! Magic ??? {}
where test() is defined as: def test(): storage = FileStorage.FileStorage('C:\Documents and Settings\Kirchhoff\My Documents\SALES\DataBase\SalesDB.fs') db = DB(storage) connection = db.open() dbroot = connection.root() DB.dbroot = { 'testme' : {'i love tests' : [1,2,3]}} get_transaction().commit() print 'Here it is:' print DB.dbroot.keys() pprint.pprint(DB.dbroot) connection.close() db.close() storage.close() storage = FileStorage.FileStorage('C:\Documents and Settings\Kirchhoff\My Documents\SALES\DataBase\SalesDB.fs') db = DB(storage) connection = db.open() dbroot = connection.root() print '... and now its empty ! Magic ???' pprint.pprint(dbroot) connection.close() db.close() storage.close() return
maybe it's that you are printing two different thing? On Wed, Dec 10, 2003 at 02:08:16PM +0900, Harm_Kirchhoff@mail.digital.co.jp wrote:
pprint.pprint(DB.dbroot)
(snip)
pprint.pprint(dbroot)
-- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's THE NOTHINGNESS! (random hero from isometric.spaceninja.com)
Harm_Kirchhoff@mail.digital.co.jp wrote at 2003-12-10 14:08 +0900:
I seem not to be able to save my data to ZODB, I wonder what I do wrong here: ... storage = FileStorage.FileStorage('C:\Documents and Settings\Kirchhoff\My Documents\SALES\DataBase\SalesDB.fs') db = DB(storage) connection = db.open() dbroot = connection.root()
DB.dbroot = { 'testme' : {'i love tests' : [1,2,3]}}
You probably want to modify "dbroot" (the root of your datbase). What you do is: give the DB class a new attribute "dbroot". This is something completely different. Try: "dbroot['testme'] = ..."
get_transaction().commit()
And be a bit more careful... -- Dieter
participants (3)
-
Dieter Maurer -
Harm_Kirchhoff@mail.digital.co.jp -
Paul Winkler