it's a good question, actually supporting both .something and ['something'] syntax is a very old time choice, that is there since 2.0. The issue is that it actually doesn't support both syntaxes, the .something syntax is only supported for first level options and what's happening is that base_config.flash.templates gets converted to base_config['flash']['template'] but as the option is actually named 'flash.template' and there is no 'flash' dictionary that contains the 'template' value it crashes when you try to set/read it using the .flash.template syntax.
The current config system in TG was actually an extension over the Pylons config system and so had some odd behaviours caused by the fact that is was actually a mix of the two config systems. Due to backward compatibility the 2.3 released kept the same behaviours even though it didn't use Pylons anymore. This is one of the things I'm working on to resolve for 2.4 which will have a better engineered config system meant explicitly for TG and that will also be able to automatically generate documentation of the configuration options. On Tue, Oct 21, 2014 at 11:51 AM, lebouquetin <[email protected]> wrote: > I reply to myself. I found the right documentation : > http://turbogears.readthedocs.org/en/latest/turbogears/webflash.html#customizing-flash > > Something I do not understand is that we have some base_config parameters > through attributes and some others through dict-like access. What is the > difference ? > > Damien > > > Le mardi 21 octobre 2014 11:41:21 UTC+2, lebouquetin a écrit : > >> Hi Alessandro, >> >> I'm trying to customize the flash templates according to the release >> 2.3.4 documentation : http://turbogears.readthedocs. >> org/en/latest/reference/config-options.html#flash-messages >> >> In my app_cfg.py I added the following line : >> >> base_config.flash.template = '<div id="${container_id}">AGAGA <div >> class="${status}">${message}</div></div>' >> >> which result in error when running turbogears: >> >> File "/home/damien/proj/tracim-app/pod/pod/pod/config/middleware.py", >> line 4, in <module> >> from pod.config.app_cfg import base_config >> File "/home/damien/proj/tracim-app/pod/pod/pod/config/app_cfg.py", >> line 47, in <module> >> base_config.flash.template = '<div id="${container_id}">AGAGA <div >> class="${status}">${message}</div></div>' >> File >> "/home/damien/proj/tracim-app/pod/tg2env/lib/python3.2/site-packages/tg/util.py", >> line 21, in __getattr__ >> return get_partial_dict(name, self, Bunch) >> File "/home/damien/proj/tracim-app/pod/tg2env/lib/python3.2/site- >> packages/tg/configuration/utils.py", line 42, in get_partial_dict >> raise AttributeError >> AttributeError >> >> What am I doing wrong ? >> >> Thanks for your answer. >> >> Damien >> >> >> Le lundi 15 septembre 2014 17:14:31 UTC+2, Alessandro Molina a écrit : >>> >>> Next release is planned for end of September, in worst case October. >>> >>> All features are there, I just need to update documentation to >>> automatically retrieve configuration options from source code and test >>> changes on a few big real world projects to ensure backward compatibility. >>> >>> On Mon, Sep 15, 2014 at 3:42 PM, lebouquetin <[email protected]> wrote: >>> >>>> Hi Alessandro, >>>> >>>> I'm working on TG2.3.3 and want to customize flash message templates. I >>>> see that you have commit this feature at the end of july... >>>> My question is : should I hack TG2 or should I wait for the next >>>> release ? (if you already planned it) >>>> >>>> Thanks >>>> >>>> Damien >>>> >>>> -- >>>> 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 http://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 http://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 http://groups.google.com/group/turbogears. For more options, visit https://groups.google.com/d/optout.

