Thanks for your help Massimo

Although now I'm getting this error:

File"/home/daniel/dev/tempw2p/web2py/gluon/dal.py",line5496,instartswith
    return self.type.startswith(self,text)
TypeError:slice indices must be integersor None orhave an __index__ method


On 2011-12-08 15:36, Massimo Di Pierro wrote:
Good point. I have a possible fix to trunk, please check if it
resolves the problem.

On Dec 8, 8:11 am, Daniel Blomqvist<dan...@emediate.se>  wrote:
Hello, I tried making a query like this:

db(db.table.field.contains(1)).select()

where the field is a SQLCustomType with type 'list:integer' and native
'int(11)'

The query does not work because of this function in gluon.dal.SQLCustomType:

def startswith(self, dummy=None):
          return False
Why does this always return false?
I get this exception from gluon.dal.Expression in the contains function:

if not self.type in ('string', 'text') and not
*self.type.startswith('list:')*:
              raise SyntaxError, "contains used with incompatible field type"

Am i missing something? Is this not supposed to be allowed?


Reply via email to