Re: Re: Maybe problems with Metakit 2.4.9.3
mARK bLOORE <[email protected]>
| Newsgroups | gmane.comp.db.metakit |
|---|---|
| Message-ID | <[email protected]> |
i don't know if this has anything to do with it, but i noticed (and posted here) some time ago that if one does a find (using C++, in my case) with a row that was constructed in a different order than the fields are given in the getas call, then the find fails. this python API is rather different, in particular find seems to take two separate args, rather than one row that was built with two fields, but i wonder if maybe the python find constructs a row behind the scenes, in reverse order? --- Yasushi Iwata <[email protected]> wrote: > Hi, > > I found another problem. Following code dose not work as expected. > > -- > > db = metakit.storage('foo.dat', 1) > > comments = db.getas( > 'comments[user:S,paragraph:S,link:S,notes[name:S,email:S,url:S,comment:S,date:S]]' > ).ordered(2) > > for i in range(1, 3): > print 'Appending %d...' % i > comments.append({ > 'user': '00000001', > 'paragraph': 'P%d' % i, > 'link': 'http://foo.com/', > }) > print '%d OK' % i > db.commit() > > for i in range(1, 3): > idx = comments.find(user='00000001', paragraph='P%d' % i) > > if idx == -1: > print 'P%d not found' % i > else: > print comments[idx].paragraph, 'found' > > -- > > $ python2.3 foo.py > Appending 1... > 1 OK > Appending 2... > 2 OK > P1 not found > P2 not found > > But if you remove ordered(2) from getas(), it works as expected. I > also removed ordered(2) from example code that I posted yesterday, it > worked fine. There must be something wrong with ordered(). ===== -- mARK bLOORE <[email protected]> __________________________________ Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25¢ http://photos.yahoo.com/ph/print_splash _____________________________________________ Metakit mailing list - [email protected] http://www.equi4.com/mailman/listinfo/metakit