Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #2247 (closed defect: fixed)

Opened 10 years ago

Last modified 10 years ago

TG2 should use pylons.strict_c on by default

Reported by: jorge.vargas Owned by:
Priority: high Milestone: 2.1a2
Component: TurboGears Version: 2.0b6
Severity: major Keywords:


Currently if you make a mistake (typo or bad name) in your templates tmpl_context (aka pylons.c) will return a string of length 0, this is specially misleading when working with TW as it will give the error "str object not callable"


if asbool(config['debug']):
    config['pylons.strict_c'] = True

or even better simply set it on by default always and let weberror handle the AttributeError? Note: pjenvey said this will be on by default in pylons 1.0

Change History

comment:1 Changed 10 years ago by mramm

  • Priority changed from normal to high

comment:2 Changed 10 years ago by percious

  • Status changed from new to closed
  • Resolution set to fixed

comment:3 Changed 10 years ago by percious

Comments to be included with RELEASE of 2.1a1:

This change may cause some of your templates to not work any more, because we are setting the variable that requires your templates to call objects within the tmpl_context that are there. If a key is not available in the template you are calling, it _will_ now throw an exception. If you need an emergency fix to get back and running while you are getting your templates fixed, you can add this code to your app_cfg.py file:

            from tg.configuration import AppConfig
            from pylons import config
            class MyAppConfig(AppConfig):
                def after_init_config(self):
                    config['pylons.strict_c'] = False
            base_config = MyAppConfig()
Note: See TracTickets for help on using tickets.