On Friday, April 1, 2011 2:22:55 PM UTC-4, Mike wrote: 
>
> Nevermind. I thought there was a builtin web2py way for this but I 
> just did this instead (after sifting more through the groups): 
>
> def groupadd(check_group): 
>     if not db(db.auth_group.role==check_group).count(): 
>      db.auth_group.insert(role=check_group) 
>
> groupadd('Admins') 
> groupadd('Maintenance Users') 
> groupadd('Download Users') 

 
If that's in a model file, it seems like you're doing an unnecessary 
database hit on every single request. If you just need to create those three 
groups one time, why not just do so outside the application code? Or maybe 
create an action in a controller and just call it once.
 

Reply via email to