Doesn't seem like a great idea to be repeating table definitions. Maybe you
should put this one in a non-conditional model file, or define it in a
module and do an import.
Anthony
On Tuesday, July 3, 2012 6:33:28 AM UTC-4, selecta wrote:
>
> In my project I use conditional models since I have a lot of tables.
> However I have a problem since one of the database tables (defined in a
> conditional model) has to be defined in another conditional model
> here an example
> /models/plugin_restapidoc/plugin_restapidoc.py
> /models/wizard/wizard.py
> /models/wizard/plugin_restapidoc.py
>
> plugin_restapidoc.py contains the same table definition,
> the table is used in the wizard and in the plugin_restapidoc controller
> this works fine, but fails when i call the db appadmin
>
> my workaround so far is
> models/db.py:
> PLUGIN_RESTAPIDOC_DEFINED = False
> /models/plugin_restapidoc/plugin_restapidoc.py:
> PLUGIN_RESTAPIDOC_DEFINED = True
> /models/wizard/plugin_restapidoc.py:
> if PLUGIN_RESTAPIDOC_DEFINED:
> define table ...
>
> I wonder if there is a better solution, e.g. one without
> the PLUGIN_RESTAPIDOC_DEFINED variable
> e.g.
> if db.tables.has_key('plugin_restapidoc_table'):
> define table ...
> or even better a fix in the appadmin
>