I am not sure I understand the following paragraph in the book:
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#on_define
I have lazy_table = true and a
Field('vertex_id', 'reference vertex', requires=IS_IN_DB(db,
'vtx_vertex.id', '%(id)s'))
In the book it says:
The simple requires values could be added to the Field definitions and the
table would still be lazy.
However, requires which take a Set object as the first argument, such as
IS_IN_DB, will make a query like
db.sometable.somefield == some_value
which would cause sometable to be defined early. This is the situation
saved by on_define.
Does this mean that I should put IS_IN_DB() in the on_define keyword
argument?
on_define = lambda table:
[table.vertex_id.set_attributes(requires=IS_IN_DB(db, 'vtx_vertex.id',
'%(id)s')]
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/12ced8d4-e5d8-44ec-8082-13338ef8f0c2%40googlegroups.com.