On 2/1/06, Matthew Bevan <[EMAIL PROTECTED]> wrote:
> > sitetemplate no longer works for me...
>
> The call to loadBaseTemplates() in view.py is placed at root-level, and thus
> is called upon the first import.  That function calls _choose_engine(), which
> in turn calls _load_engines(), which reads the not-yet-set-up configuration.
>
> A fix to this would be to have each "module" within the main TG package that
> runs code at import to export an init function which is called /after/
> configuration and before CherryPy startup.  Or simply hold off all of those
> imports in TG's __init__.py and perform them in a called function instead.

At this point, I just dropped in the straightforward fix and moved
that one function call out to startup.py. More productive than
exporting an init function might be to plug in something like
PyDispatcher that allows anyone that needs to to listen for
interesting events (server startup/shutdown, config file loading,
etc.). Either that, or just create specific subject/observer
functions, which is really not very difficult :)

For now, the simple solution will do, I think.

Kevin

Reply via email to