add controller utility method for providing (skin-dependent) macros identified by a unique name

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3951 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2010-08-14 19:19:16 +00:00
parent 584057c173
commit d2963ca3be

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
# Copyright (c) 2010 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -43,6 +43,7 @@ class Controller(object):
self.configure()
#self.view.setupController()
self.view.controller = self # notify the view
self.templates = {}
skin = None # may be overwritten by the view
@ -76,6 +77,12 @@ class Controller(object):
IMemberInfoProvider)
return provider is not None and provider.data or None
def getTemplateMacros(self, name, default):
template = self.templates.get(name)
if template is None:
template = default
return template.macros
class Macros(dict):