thanks alessandro. if i create a method that returns
config.get("setting_key") and access it in my template like
h.get_value() it returns the correct value. the problem was i was
trying to access an attribute so the initial config did not have that
setting.

On Dec 23, 8:37 pm, Alessandro Molina <[email protected]>
wrote:
> tg.config should be available if you are calling the helper from a request.
> When called from outside a request flow or inside a global object
> (which is built at application startup before there is a request) it
> will have default values.
>
>
>
>
>
>
>
> On Fri, Dec 23, 2011 at 5:41 PM, Mengu <[email protected]> wrote:
> > yup, in the templates i have no problem obtaining the setting value.
> > in mako i do it with ${config.get('setting_key')}. i only wonder why
> > it is not available when helpers.py is executed.
>
> > On Dec 23, 6:33 pm, León Domingo <[email protected]> wrote:
> >> Hi,
> >> As far as I know you can get a value from the .ini file using {{
> >> tg.config.get(<key> [, <default_value>]) }}
>
> >> *{{ }} is Jinja2 notation
>
> >> León Domingo
>
> >> Ender - Factoría de Software
> >> [email protected] <[email protected]>
> >> Avda. Cerro del Águila, 7. S23 - 2ª Planta
> >> 28703 S.S. de los Reyes (MADRID)
> >> Tlf. 902 01 44 01
>
> >> <http://www.ender.es/>
> >> <http://www.facebook.com/home.php?#%21/pages/San-Sebastian-de-los-Reye...>
> >> * <http://www.ender.es>*
>
> >> On 23 December 2011 16:06, Mengu <[email protected]> wrote:
>
> >> > hi,
>
> >> > i wanted to ask you guys something about configuration and helpers.py
> >> > file.
>
> >> > in my development.ini i have a setting that i wish to get via
> >> > config.get("setting_key") in helpers.py so it's available in my
> >> > template files but this is returning None. if i try to access
> >> > config.get("setting_key") a template file, i get the right value. why
> >> > is this happening?
>
> >> > --
> >> > 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.
>
> > --
> > 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 
> > athttp://groups.google.com/group/turbogears?hl=en.

-- 
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.

Reply via email to