Straight to the point:
I'm using *lazy_tables=True* and *migrate=False*
*In my model, I have several Method Fields.*
Some of them use a function that is declared inside the same model, like
this:
db.auth_user.give_me_data = Field.Method(lambda row: _give_me_data(row.
auth_user))
def _give_me_data(user):
# calculation and obtention of data
# return data
So first question: *should I move declaration of _give_me_data function to
a module?*
Or is it the same because I would have to import it anyway in the model?
*Just to remind, I'm using lazy_tables=False, so maybe the code isn't
really executed until the table is called. I'm not sure about this.*
*Usage of Storage class objects*
In my models, I create some Storage objects, because it's really useful for
setting and retrieving data from those objects. I use them like this:
from gluon.tools import Storage
CONFIG = Storage()
CONFIG.variable1 = 'value-variable-1'
CONFIG.variable2 = 'value-variable-2'
I don't put much data inside them, just config variables.
However, my question is: *should I use other data type to storage those
variables?* Or it won't make any difference?
Thats all for now. Any comment will be appreciated. Thanks in advance!
--
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.