Commits

Joseph Tate  committed 34e3f3f

Get default templastes from config

  • Participants
  • Parent commits 7544bf0

Comments (0)

Files changed (3)

File c5t/core/controllers/page.py

 from tg import expose, require, request, redirect, tmpl_context, response, flash, validate
 from tg.render import render_mako ,_get_tg_vars
 from pylons.controllers.util import abort
+from pylons import config
 
 from tg.util import DottedFileNameFinder
 from tg.decorators import with_trailing_slash
 
 class PageController(RestController):
 
-    default_custom_template_path = 'c5t.core.templates.page.custom'
-    default_template_name        = 'c5t.core.templates.page.default'
-    boilerplate_template_path    = 'c5t.core.templates.page.default'
+    # Load the templates from the config file
+    default_custom_template_path    = config.get('c5t.template.page.custom', 'c5t.core.templates.page.custom')
+    default_template_name           = config.get('c5t.template.page.default', 'c5t.core.templates.page.default')
+    boilerplate_template_path       = config.get('c5t.template.page.default', 'c5t.core.templates.page.default')
 
     # right now Ming doesn't handle
     # inheritance for searches very well, so

File c5t/core/forms/page.py

 from tg import request
+from pylons import config
 import tw2.forms as twf
 import tw2.forms.widgets
 import tw2.core.validation as twv
 
 class TemplateField(twf.widgets.InputField):
     template="mako:c5t.core.forms.templates.template_field"
-    default_template_name = 'c5t.core.templates.page.default'
+    default_template_name = config.get('c5t.template.page.default', 'c5t.core.templates.page.default')
     def prepare(self):
         self.template_list = make_template_list()         
         

File development.ini

 use = egg:c5t.core
 full_stack = true
 #lang = ru
+
+c5t.template.page.custom = c5t.core.templates.page.custom
+c5t.template.page.default = c5t.core.templates.page.default
+c5t.template.boilerplate = c5t.core.templates.page.default
+
 cache_dir = %(here)s/data
 beaker.session.key = c5t_beaker
 beaker.session.secret = 704c6b5d-6959-4cec-8b00-2216807b93d9