Add template "theme" feature, albeit global
would be even better to let each user session have something different, but alas this is all-or-nothing for now
This commit is contained in:
parent
f05d50bce3
commit
ea0dc1ea19
8 changed files with 377 additions and 20 deletions
|
@ -43,6 +43,8 @@ from pyramid.authentication import SessionAuthenticationPolicy
|
|||
import tailbone.db
|
||||
from tailbone.auth import TailboneAuthorizationPolicy
|
||||
|
||||
from tailbone.util import get_effective_theme, get_theme_template_path
|
||||
|
||||
|
||||
def make_rattail_config(settings):
|
||||
"""
|
||||
|
@ -123,6 +125,10 @@ def make_pyramid_config(settings, configure_csrf=True):
|
|||
if config:
|
||||
config.set_root_factory(Root)
|
||||
else:
|
||||
|
||||
# we want the new themes feature!
|
||||
establish_theme(settings)
|
||||
|
||||
settings.setdefault('pyramid_deform.template_search_path', 'tailbone:templates/deform')
|
||||
config = Configurator(settings=settings, root_factory=Root)
|
||||
|
||||
|
@ -156,6 +162,16 @@ def make_pyramid_config(settings, configure_csrf=True):
|
|||
return config
|
||||
|
||||
|
||||
def establish_theme(settings):
|
||||
rattail_config = settings['rattail_config']
|
||||
|
||||
theme = get_effective_theme(rattail_config)
|
||||
settings['tailbone.theme'] = theme
|
||||
|
||||
path = get_theme_template_path(rattail_config)
|
||||
settings['mako.directories'].insert(0, path)
|
||||
|
||||
|
||||
def configure_postgresql(pyramid_config):
|
||||
"""
|
||||
Add some PostgreSQL-specific tweaks to the final app config. Specifically,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue