init_model is called after app_cfg.py is loaded when the application
is actually started up.  The call is part of the load_environment
call, you can see how this is done in tg/configuration.py, but
basically I think you'll want to to import base_config from app_config
inside of init_model and set those values on the base_config right
there in init_model.

Haven't tried it, so I may be missing something, let me know how it
works out for you.

--Mark

On Wed, May 27, 2009 at 6:53 PM, shadowfox <[email protected]> wrote:
>
> Hi all,
>
> I have a legacy database that maps pretty much 1-to-1 to TG2's repoze
> authentication/authorization structure (User, Group, Permission).
>
> As the tables are existing ones, I tried to use the SQLAlchemy
> reflection to define the model for these tables, that is, inside the
> init_model() function in project.model.__init__.py file.
>
> Problem is, when I specify the model to use in app_cfg.py as such:
>
>    base_config.sa_auth.user_class = model.Users
>
> The init_model() has not been called yet, thus halting the application
> with an object not found error.  In fact, I don't see the init_model()
> being called anywhere.  Is this correct?
>
> How do I resolve this interdependency? where should I call the
> init_model() before the app_cfg.py is being imported?
>
> Any ideas?
> >
>



-- 
Mark Ramm-Christensen
email: mark at compoundthinking dot com
blog: www.compoundthinking.com/blog

--~--~---------~--~----~------------~-------~--~----~
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