Juparave schrieb:
> Crusty,
> 
> May I ask another question?  Remember that global variable we where
> talking about?
> Where do you recommend to initialize it if my value is stored in a
> settings table?  Tried to initialize it inside Globals but it sends an
> error:
> 
> sqlalchemy.exc.UnboundExecutionError: Could not locate a bind
> configured on mapper Mapper|Settings|settings, SQL expression or this
> Session
> 
> My guess is that Globals is initialized before database binding, so
> there must be a place where I can initialize this and any other global
> variable, isn't it?

It's called "variable providers". There is no real location for these, 
but I put it into the root of my template-dir as file 
"variable_provider.py".

In there, I define one callable, again "variable_provider", which 
returns a dict.

This then gets imported in "config/app_cfg.py" and there is a line

   base_config.variable_provider = variable_provider

This will make sure that in all templates, I have (under no special 
scope, top-level) the returned names/objects available.

I'm not sure if that's part of the quickstart-template yet, might be 
worth considering.

Diez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to