durusmail: durus-users: pack confusion
pack confusion
2004-11-09
2004-11-09
pack confusion
Mario Ruggier
2004-11-09
Hello,

i was trying to delete some items from a durus db, but the "apparently"
correctly deleted items do not disappear. I thought it was something
bizarre in my case, but boiling it down to the trivial example below
the behaviour is the same. Running the code below twice should
demonstrate what I mean... that is the object root['x'] stays there no
matter what! Durus 1.2, Py 2.3 on OS X Panther.

Have I completely misunderstood pack() ?
Can anyone clarify ?

Cheers, mario


#### pack_test.py

from durus.file_storage import FileStorage
from durus.connection import Connection

_filepath = 'packtest.durus'

con = Connection(FileStorage(_filepath))
root = con.get_root()

print 'before... '
print root
print root.items()

if root.has_key('x'):
     print 'deleting x...'
     del root['x']
     con.pack()
     con.commit()
else:
     print 'adding x...'
     root['x'] = 'pack test'
     con.commit()

print 'after... '
print root
print root.items()

####


reply