Hello,
I created an in-memory db. Added two views,
one stored as an attribute in the other.
Both views are created with getas(), so they
should be persistent.
After saving the database with save(), and
reloading it, the child view cannot be
retrieved from the parent view.
Does anyone have idea why this doesn't work?
I've attached the script and the output below.
I am using Python 2.3b1 on win xp prof
and metakit 2.4.9.2
Thanks,
Maciej
Here is the script:
##############################################
import metakit as m
def showDb (db, msg):
print "======================="
print msg
print "======================="
p = db.view('parent')
c = p[0].children
print "View 'parent':"
m.dump(p)
print "View 'child':"
m.dump(c)
##
##
##
mem_db = m.storage()
p = mem_db.getas('parent[name:S,children:V]')
c = mem_db.getas('child[name:S]')
c.append(name='a child')
p.append(name='a parent', children=c)
filename = 'qq.mk'
mem_db.save(open(filename, 'wb'))
file_db = m.storage(filename, 1)
showDb(mem_db , "DB in memory:")
showDb(file_db, "DB in file:")
file_db = None
import os
os.remove(filename)
########################################
And here is the output:
=======================
DB in memory:
=======================
View 'parent':
name children
-------- --------
a parent 1 rows
-------- --------
Total: 1 rows
View 'child':
name
-------
a child
-------
Total: 1 rows
=======================
DB in file:
=======================
View 'parent':
name children
-------- --------
a parent 1 rows
-------- --------
Total: 1 rows
View 'child':
Total: 1 rows
_______________________________________________
metakit mailing list - [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit