I found an answer to my own question :
I split my model (plugin_name.py) into multiple files (0_settings.py, 1_user.py, etc.) and put them all in a folder ./models/plugin_name/
Web2py does detect that all my model files belong to the same plugin and packs them together.
Another problem happens if I do things that way tho :
I use a database_uri as plugin parameter to define models (tables, fields, callbacks, etc.) in my plugin.
- When I access this database from appadmin, the tables work fine (validators, callback, everything).
- When I access this database from my main application (the one onto which my plugin is installed), my database isn't recognized at all.
From lurking on this fine forum, I established that I have 3 options here :
- Work around database cooperation (http://web2py.com/books/default/chapter/29/04#Cooperation)
- Use the auto_import=true argument in the DAL
- Rename the model files that came with my plugin, so all model features are available in the global namespace
So far, I am unsatisfied with all 3 options, with a good reason for each of those :
- Because I have dependencies between tables which makes it very difficult to cleanly manage all those imports
- Because auto_import doesn't manage to retrieve callbacks & validators, which leaves me with half the work left to do
- Because it would defeat the purpose of making a plugin in the first place
I'm a mere padawan on this fine community, so if a web2py guru happens to read this thread I would appreciate any tip he could provide to face this issue !