I have the following table definition
db.define_table('ntw_edge',
Field('outID', 'reference vtx_vertex', default='', requires=[IS_IN_DB(db, '
vtx_vertex.id', '%(name)s')], ondelete='CASCADE', notnull=True, label='Out *', represent=lambda outID, row: db(
db.vtx_vertex.id==outID).select().first().name if outID else ''),
Field('inID', 'reference vtx_vertex', default='', requires=[IS_IN_DB(db, '
vtx_vertex.id', '%(name)s')], ondelete='CASCADE', notnull=True, label='In *', represent=lambda inID, row: db(
db.vtx_vertex.id==inID).select().first().name if inID else ''),
Field('label', length=128, default='', ondelete='RESTRICT', notnull=True, widget=SQLFORM.widgets.options.widget, label='Label *'),
migrate = False)
In a function I have the following query:
vertices = db(db.ntw_edge.outID==1151).select(db.ntw_edge.inID, distinct=db.ntw_edge.inID)
events = db(db.event_list.vertexID.belongs(vertices)).select()
When I run the function I get an error
<type 'exceptions.TypeError'> long() argument must be a string or a number, not 'NoneType'
When I replace vertice with: (6, 28, 496, 1024)
events = db(db.event_list.vertexID.belongs((6, 28, 496, 1024)).select()
I get the right result.
So the problem is with:
vertices = db(db.ntw_edge.outID==1151).select(db.ntw_edge.inID, distinct=db.ntw_edge.inID)
Does it have anything to do with the valiadtor IS_IN_DB() or the represent? How do I solve
this issue?
Kind regards,
Annet