Not sure there is a way to achieve that. As `get` copies the value of an option from the value value of the global, what should be the value for a global that doesn't exist?
In this specific case I think you might want to provide a default by setting "email_to=" so that `get trace_errors.error_email = email_to" can work but error email is disabled as it's empty. On Sun, Feb 19, 2017 at 7:34 PM, Thomas De Schampheleire < [email protected]> wrote: > On Fri, Jan 27, 2017 at 8:58 PM, Thomas De Schampheleire > <[email protected]> wrote: > > Hi Alessandro, > > > > On Sat, Jan 21, 2017 at 2:52 AM, Alessandro Molina > > <[email protected]> wrote: > >> If I understand correctly, what you want to do is derive a configuration > >> option from one that is provided in the configuration file, before the > >> configuration file is provided to TG. As you only have an > >> `after_init_config` hook point, but no `before_init_config` that's > what's > >> making your life hard. > >> > >> I would say, that as you noticed everything is in fact stored into > >> `tg.errorware` and you can freely change your value there in > >> `after_init_config` as it was not yet used by TurboGears. So you can > just > >> get your option and put it into the errorware dictionary. > >> > >> My solution by the way is usually to move this problem to the > configuration > >> layer. In fact the problem is that you want to reuse the same value for > two > >> different configuration options, and that is made possible by > PasteDeploy > >> itself. > >> > >> So my typical configuration file in this case provides both options > with a > >> reference to the shared value. > >> For Example a development.ini might look like: > >> > >> # The Shared Value > >> set depot_backend_type = depot.io.local.LocalFileStorage > >> > >> # The Actual Value for option1 > >> get depot.storage1.backend = depot_backend_type > >> # The Actual Value for option2 > >> get depot.storage2.backend = depot_backend_type > >> > >> This allows me to change both option1 and option2 by changing > >> `depot_backend_type` but still gives me the flexibility to change > backend > >> only for storage1 or storage2 whenever I want. > >> > > > > I tried this: > > > > get trace_errors.error_email = email_to > > get trace_errors.smtp_server = smtp_server > > get trace_errors.smtp_port = smtp_port > > get trace_errors.from_address = error_email_from > > > > which works, but only if the values of email_to, smtp_server, ... are > > effectively specified. If they are not present, this gives an error at > > startup of the application. > > > > My goal was to add the above snippet (or a variation of it) in our > > default ini files, and ini file template, so that users don't need to > > care about it. However, we do not have default values for these > > settings. > > > > Do you know how to achieve this? > > > > Also, I couldn't find documentation for these 'get' keyword. The 'set' > > is documented in PasteDeploy documentation, but 'get' is not. > > > > > Kind reminder.. > > -- > 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. > -- 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.

