Changeset 4692

Show
Ignore:
Timestamp:
06/09/08 17:40:39 (5 months ago)
Author:
mramm
Message:

Oops. I accidentally checked in a partial commit of the buffet removal stuff. Fixed now.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • projects/tg.devtools/trunk/devtools/templates/turbogears/+package+/config/environment.py_tmpl

    r4687 r4692  
    1010{{endif}} 
    1111from pylons import config 
     12 
    1213from pylons.i18n import ugettext 
    1314from genshi.filters import Translator 
    1415from tg import defaults 
    15 from tg.render import render_json, render_genshi, render_mako 
    1616 
    1717{{if sqlalchemy}} 
     
    2525from {{package}}.model import init_model, DBSession, metadata 
    2626{{endif}} 
    27 {{if identity=='sqlalchemy'}}  
    28 {{package}}.model import User, Group, Permission 
     27{{if identity=='sqlalchemy'}} 
     28from {package}}.model import User, Group, Permission 
    2929{{endif}} 
    30  
    31  
    3230 
    3331{{if template_engine == 'genshi'}} 
     
    7169                      } 
    7270     
     71 
    7372    {{endif}} 
    7473     
     74    {{if template_engine == 'mako'}} 
     75    # Create the Mako TemplateLookup, with the default auto-escaping 
     76    config['pylons.app_globals'].mako_lookup = TemplateLookup( 
     77        directories=paths['templates'], 
     78        module_directory=os.path.join(app_conf['cache_dir'], 'templates'), 
     79        input_encoding='utf-8', output_encoding='utf-8', 
     80        imports=['from webhelpers.html import escape'], 
     81        default_filters=['escape']) 
     82    {{elif template_engine == 'genshi'}} 
     83     
     84    # Create the Genshi TemplateLoader 
     85    config['pylons.app_globals'].genshi_loader = TemplateLoader( 
     86        paths['templates'], auto_reload=True) 
     87    {{elif template_engine == 'jinja'}} 
     88 
     89    # Create the Jinja Environment 
     90    config['pylons.app_globals'].jinja_env = Environment(loader=ChoiceLoader( 
     91            [FileSystemLoader(path) for path in paths['templates']])) 
     92    # Jinja's unable to request c's attributes without strict_c 
     93    config['pylons.strict_c'] = True 
     94    {{endif}} 
     95 
     96    # If you'd like to change the default template engine used to render 
     97    # text/html content, edit these options. 
     98    default_template_engine = 'genshi' 
     99    default_template_engine_options = {} 
     100    config['buffet.template_engines'].pop() 
     101    config.add_template_engine(default_template_engine, '${package}.templates', 
     102                               default_template_engine_options) 
     103 
    75104    {{if sqlalchemy}}     
    76105    # Setup SQLAlchemy database engine 
     
    83112    {{endif}} 
    84113     
    85     # Template rendering setup: 
    86      
    87     {{if template_engine == 'mako'}} 
    88     # Create the Mako TemplateLookup, with the default auto-escaping 
    89     config['pylons.app_globals'].mako_lookup = TemplateLookup( 
    90         directories=paths['templates'], 
    91         module_directory=os.path.join(app_conf['cache_dir'], 'templates'), 
    92         input_encoding='utf-8', output_encoding='utf-8', 
    93         imports=['from webhelpers.html import escape'], 
    94         default_filters=['escape']) 
    95      
    96     config['tg.default_renderer'] = 'mako' 
    97          
    98     {{elif template_engine == 'genshi'}} 
    99     # Create the Genshi TemplateLoader 
    100     config['pylons.app_globals'].genshi_loader = TemplateLoader( 
    101         paths['templates'], auto_reload=True) 
    102      
    103     config['tg.default_renderer'] = 'genshi' 
    104          
    105     {{elif template_engine == 'jinja'}} 
    106     # Create the Jinja Environment 
    107     config['pylons.app_globals'].jinja_env = Environment(loader=ChoiceLoader( 
    108             [FileSystemLoader(path) for path in paths['templates']])) 
    109     # Jinja's unable to request c's attributes without strict_c 
    110     config['pylons.strict_c'] = True 
    111     config['tg.default_renderer'] = 'jinja' 
    112     {{endif}} 
    113      
    114     # config['template_engines'] contains a dictionary of renderers which you can update here 
    115     # the keys are the name of the rendering engine, and the values the rendering function.  
    116     # by default render_json, and render_genshi, and render_mako are available.  
    117      
    118     # app_globals['template_engines']['my_engine] = my_renderer 
    119      
    120114    # CONFIGURATION OPTIONS HERE (note: all config options will override 
    121115    # any Pylons config options)