you define them in the Global object.

class Globals(object):
    myconstant = 'astring'

etc...

and then in the app use g.myconstant wherever you need it.  These
don't, by convention, ever get modified.  Generally it would be a bad
idea to do that as it would result in concurrency issues.

It seems like a good place to keep constants that are used throught
the app.

Damian

On Dec 20, 9:05 pm, Mike Orr <[email protected]> wrote:
> How do you add variables to the globals? I think you'd have to
> override render_mako.
>
>
>
>
>
> On Sun, Dec 20, 2009 at 12:59 PM, Damian <[email protected]> wrote:
> > FWIW - we make quite heavy use of 'g' for defining constant strings
> > that are used to generate our JSON, so the javascript knows what to
> > look for in the template and pylons sends the right stuff back even if
> > we chose to change the constant string.
>
> > d
>
> > On Dec 20, 8:12 pm, Mike Orr <[email protected]> wrote:
> >> On Sun, Dec 20, 2009 at 10:11 AM, Ben Bangert <[email protected]> wrote:
> >> > On Dec 18, 2009, at 7:59 PM, Mike Orr wrote:
>
> >> > Mike, 'c' will remain in templates in 1.0, 'g' will be app_globals, 
> >> > though one can of course add variables as desired to the Pylons globals 
> >> > in templates if 'g' is still desired.
>
> >> That's fine. 'c' and 'h' are the vital ones. I don't use app_globals
> >> much anyway, and I've never used it in a template.
>
> >> --
> >> Mike Orr <[email protected]>
>
> > --
>
> > You received this message because you are subscribed to the Google Groups 
> > "pylons-discuss" 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/pylons-discuss?hl=en.
>
> --
> Mike Orr <[email protected]>

--

You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en.


Reply via email to