Python Patch for inserting a view into a view

Brian Kelley <[email protected]>
Newsgroups gmane.comp.db.metakit
Message-ID <[email protected]>
At long last, attached is the diff and the new PyView.cpp file that
allows the python interface to insert a view into another view.

usage:
 view.insert(index, view2)
is now supported.  Properties that don't exist in view but exist in
view2 will be added to view.

example:

import metakit

st = metakit.storage()
v = st.getas("test[a:i,b:S,c:S]")
v2 = st.getas("test2[d:i]")

for i in range(100):
    v.append((i, str(i), str(i)))

v2.append((1,))
v2.insert(0, v)
metakit.dump(v2)
del st

Enjoy!

_____________________________________________
Metakit mailing list  -  [email protected]
http://www.equi4.com/mailman/listinfo/metakit
PyView.cpp.diff (application/octet-stream, 235 B)
1179,1181c1179,1185
<   c4_Row temp;
<   makeRow(temp, o);
<   InsertAt(i, temp);
---
>   if(PyGenericView_Check(o))
>     InsertAt(i, *(PyView *)o);
>   else {
>     c4_Row temp;
>     makeRow(temp, o);
>     InsertAt(i, temp);
>   }
PyView.cpp (application/octet-stream, 40 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.