On Thursday, April 14, 2011 3:09:58 PM UTC-4, DenesL wrote: 
>
>
> Note that everything (in models, controllers, and views) is python 
> code so you can check first then add if not there: 
>
> if not db(db.auth_group).select(): 
>   db.auth_group.insert(role = "Admin", description = "Admin") 
>
> or more specifically: 
>
> if not db(db.auth_group.role=='Admin').select(): 
>   db.auth_group.insert(role = "Admin", description = "Admin") 
>
 
The only downside of that approach is that you add a database hit on every 
single request for the life of your application, even though the insert 
needs to happen only once.
 

Reply via email to