is this work?

if db(db.[table-name]).count()==0:
     populate ...


2015-08-04 17:08 GMT+03:00 Luis Valladares <[email protected]>:

> Hello!
>
> Im trying to populate some fields inside my database each time is created,
> things like creating some groups in auth_groups, creating triggers for all
> the tables and adding some records in other tables, but i want this to be
> done ONLY when web2py creates the database because a lot of this records
> must be unique, so i created a file inside models to add all this info, but
> it get executed on every request of the site, i managed tu handle this
> using try..except Exception, but i dont think this is a good practice
> because it stops at every error without notifying me.
>
> There is a way to set a model file, or a set of instructions to execute
> ONLY when web2py create the tables of the database?
>
> Thanks a lot!
>
> --
> 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.
>



-- 
Selman Kocael
İsabet Yayınları

-- 
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.

Reply via email to