Jared Kuolt wrote:
I'd like to build some settings that I want to be global, meaning i
don't have to pass them to the kid templates.

How can I create a global variable so Kid can use it?

I had the same problem with variables which I wanted to go into the site's headers in master.kid some of the time. I don't know if this is the "right" way to do it, but the way I got around this was to create a header decorator in my controller:

def header():
    """Header-filling decorator."""
    def decorator(func):
        def newfunc(self, *args, **kw):
            r = func(self, *args, **kw)
            if not r.has_key('albumID'):
                r['albumID'] = ''

            if not r.has_key('pageTitle'):
                r['pageTitle'] = ''

            r['pageTitle'] = 'Shoot - ' + str(r['pageTitle'])

            return r

        newfunc.func_name = func.func_name
        return newfunc
    return decorator

And then use it on anything which output to html. You could do the same, except tossing in your globals instead of default values like I'm doing.

--Ryan

Reply via email to