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
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.