session variable? cookie?
http://lucasmanual.com/mywiki/TurboGears#head-82370b50f86921fa6bf46d01ebd7d880dd9f5ad2
If anything you could encrypt that variable to hide the id number.
Other then that you either have to look it up each time or pass it
along to each function.
Lucas
There are a bazillion ways to this, by why don't you do this - which
solves both of your problems at once?
class Group(...):
... # your declarations here
@property
def employees(self):
try:
return self.by_name("employees")
except SQLOBjectNotFound:
return self.__class__(name="employees")
Do that for all your three groups, and you're done.
Diez
Create a function initdb() and put it in model.py or in a separate
module initdb.py. In this function you check the database tables and
populate them with initial data if they are empty (groups, permissions,
admin user etc.). You can also prefetch some of the data (e.g. the
employees group) and make it available in a global object.
Call this function inside the start() function of the commands.py module
or in the __init__ method of your root controller.
Maybe we should provide some template code for this in our quickstart
templates?
-- Christoph