Hi, 

I'm setting up error reporting through e-mail in Kallithea 
(kallithea-scm.org), which is in transition from Pylons to TurboGears2.
In Kallithea, e-mail is used both for standard application purpose as for 
errors (through the web framework). As such, the .ini file has already 
settings such as

app_email_from
error_email_from
email_to
smtp_server
smtp_port
etc. 

I understood that in TG2, errorware configuration is supposed to be set in 
the ini file like:
trace_errors.smtp_server = ...
trace_errors.error_email = ...

but since we need some of these settings also for 'application' emails, I 
want to avoid duplication. And I also think it is not correct to let the 
application settings derive from 'trace_errors.'.
Instead I wanted to automatically set the trace_errors settings during 
init, based on our existing set of ini settings.

However, I have realized that TG2 does not really support this yet: 
errorware is initialized already in _init_config. By the time 
after_init_config is reached (the place where you'd add tweaks to the 
configuration based on the ini file settings) any change to 
trace_errors.foo is no longer reflected in tg.errorware or tg.slow_reqs.

In AppConfig._init_config, there are two cases related to errorware: the 
standard case where the ini file contains settings under 'trace_errors.', 
and the backwards-compatibility case where settings are still accepted at 
root level, e.g. smtp_server instead of trace_errors.smtp_server. Currently 
I fall into this second case, which is not ideal either because it could go 
away in future versions of TG2.
Moreover, I recently added support for a custom smtp_port in TG2, but did 
not add such a backward-compatible option (because it was a new setting 
anyway). So, using a custom port is still not possible in my case.

The way I see it, there should be following separate steps:
1. load configuration defaults defined by the application (as set in the 
AppConfig object)
2. load configuration from the ini file
3. call after_init_config (or another hook) to let the application tweak 
the configuration if needed
4. only now start initializing turbogears, including errorware and all the 
rest

What is your view on this?

Thanks,
Thomas

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to