can you help me debug this? Why is the code below wrong?
On Sep 10, 9:40 am, "Martin.Mulone" <[email protected]> wrote: > I report a bug with 'contains' in gae in list:string but in trunk is > not fixed. I want to know if this is going to be fixed and when > because is important. > > this simple make in gql.py do the job > > in gluon/contrib/gql.py > ----------------------------- > def contains(self, value): > if self.type.startswith('list:'): > if isinstance(value, (unicode, str) ): > value = [value] > return Query(self, 'IN', value) > else: > raise RuntimeError, "Not supported" > > PROBLEM TEST: > ============= > In gae doesn't show any record with keywords 'planet' and 'moon' > > You can verified here:http://web2pytesting.appspot.com/ultimatelist/ > > ------------- > in db.py > ------------ > > db.define_table('tags', > Field('id', 'id'), > Field('name'),format='%(name)s') > > db.define_table('testing', > Field('id', 'id'), > Field('keywords', 'list:string'), > Field('numbers', 'list:integer'), > Field('tags', 'list:reference > tags'), > migrate=True) > > testing = db(db.testing.id>0).select() > if not testing: > tag1 = db.tags.insert(name="TAG1") > tag2 = db.tags.insert(name="TAG2") > tag3 = db.tags.insert(name="TAG3") > tag4 = db.tags.insert(name="TAG4") > tag5 = db.tags.insert(name="TAG5") > tag6 = db.tags.insert(name="TAG6") > id1 = db.testing.insert(keywords=['planets', 'moon', > 'space'],numbers=[1, 11, 111, 0],tags=[tag1, tag2, tag3]) > id2 = db.testing.insert(keywords=['planets', 'mars', > 'space'],numbers=[2, 22, 222, 0],tags=[tag1, tag4, tag5]) > id2 = db.testing.insert(keywords=['planets', 'mercury', > 'space'],numbers=[3, 33, 333, 0],tags=[tag1, tag2, tag6]) > > ----------------------------- > controller/default.py > ---------------------------- > > def index(): > keys_planets = > db(db.testing.keywords.contains('planets')).select() > keys_moon = db(db.testing.keywords.contains('moon')).select() > number_0 = db(db.testing.numbers.contains('0')).select() > number_1 = db(db.testing.numbers.contains('1')).select() > return dict(keys_planets=keys_planets, keys_moon=keys_moon, > number_0=number_0, number_1=number_1)

