Users namespace index and a quick userlist.
[zzz-floof.git] / floof / model / __init__.py
1 """The application's model objects"""
2 import elixir
3 from floof.model import meta
4
5 Session = elixir.session = meta.Session
6 # Uncomment if using reflected tables
7 # elixir.options_defaults.update({'autoload': True})
8 elixir.options_defaults.update({'shortnames':True})
9 metadata = elixir.metadata
10
11 # this will be called in config/environment.py
12 # if not using reflected tables
13 def init_model(engine):
14 """Call me before using any of the tables or classes in the model"""
15 meta.Session.configure(bind=engine)
16 metadata.bind = engine
17
18 # Delay the setup if using reflected tables
19 if elixir.options_defaults.get('autoload', False) \
20 and not metadata.is_bound():
21 elixir.delay_setup = True
22
23 # # import other entities here, e.g.
24 # from floof.model.blog import BlogEntry, BlogComment
25 from floof.model.art import Art
26 from floof.model.users import User, IdentityURL
27
28 # Finally, call elixir to set up the tables.
29 # but not if using reflected tables
30 if not elixir.options_defaults.get('autoload', False):
31 elixir.setup_all()
32
33