I was able to figure out the cause of the issue. It seems that the code was executed before the configuration had been fully read and I was trying to read out configuration options when the module was loaded.
Is there some way to ensure that the configuration has been read before this point? Or is there a better place to move this code (it was under a module I added under model)? Thanks, Aly On Jun 24, 7:51 pm, KMCB <[email protected]> wrote: > Aly, > > This seems to work for me. Hope it helps. > > Regards, > KMCB > > from tg import config > import os > . > . > . > permanent_file = open(os.path.join( > config['app_conf']['permanent_store'], > fileobj.filename.replace(os.sep, '_') > ), > 'wb' > ) > > On Jun 24, 3:30 pm, Aly Merchant <[email protected]> wrote: > > > Still no luck: getattr will work with arguments like 'pylons.environ', > > but I cannot find a way to access custom settings. I am using the > > [default] section in development.ini . > > > On Jun 23, 7:33 pm, percious <[email protected]> wrote: > > > > Try using getattr instead of get. the TGConfig is a "Bunch" object. > > > > cheers. > > > -chris > > > > On Jun 23, 12:03 pm, Aly Merchant <[email protected]> wrote: > > > > > I'm having some trouble with accessing config parameters. The docs > > > > indicate that something like: > > > > > tg.config.get('mail.from.administrator', '[email protected]') > > > > > should work. However, I am not able to access anything I have set. > > > > I'm not sure if tg.config is supposed to be a dict but I am see it > > > > populated with: > > > > > {'pylons.c_attach_args': True, 'buffet.template_options': {}, > > > > 'pylons.request_options': {'errors': 'replace', 'decode_param_names': > > > > False, 'charset': 'utf-8', 'language': 'en-us'}, 'pylons.paths': > > > > {'controllers': None, 'templates': [], 'static_files': None, 'root': > > > > None}, 'pylons.environ_config': {'session': 'beaker.session', 'cache': > > > > 'beaker.cache'}, 'pylons.db_engines': {}, 'pylons.strict_c': False, > > > > 'pylons.h': None, 'pylons.package': None, 'debug': False, 'pylons.g': > > > > None, 'buffet.template_engines': [], 'pylons.response_options': > > > > {'headers': {'Pragma': 'no-cache', 'Cache-Control': 'no-cache'}, > > > > 'errors': 'strict', 'charset': 'utf-8', 'content_type': 'text/html'}} > > > > > This is with 2.0.1, I'm running in a virtualenv setup with the default > > > > "paster server development.ini" command. > > > > > Thanks, > > > > Aly > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

