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 #2439 (closed defect: fixed)

Opened 10 years ago

Last modified 9 years ago

Support ToscaWidgets resource variants and other TW config options

Reported by: chrisz Owned by:
Priority: normal Milestone: 2.1rc1
Component: TurboGears Version: trunk
Severity: normal Keywords: ToscaWidgets variants


ToscaWidgets 0.9.8 supports "variants" for Javascript and CSS resources (minified, packed or debug versions of the js/css files).

TurboGears should configure this properly in a quickstarted app.

On the TurboGears  mailing list, Diez suggested adding the following to config.middleware:

import tw.api

tw.api.resources.registry.ACTIVE_VARIANT = app_conf.get(
    "tw.resource_variant", tw.api.resources.registry.DEFAULT_VARIANT)

Then, the templates for development.ini and deployment.ini should set tw.resource_variant to 'debug' and 'minified'/'packed' respectively.

Diez also suggested passing app_conf (self) to tw.api.make_middleware (tw_middleware) in the AppConfig.add_tosca_middleware() method of the tg.configuration module. Then ToscaWidgets could care for the configuration itself, and other config-options could be set as well, e.g. require_once, serve_resources and so on.

Change History

comment:1 Changed 9 years ago by percious

  • Milestone changed from 2.1 to 2.1b2

comment:2 Changed 9 years ago by percious

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

I added this as a config option in the "toscawidgets" section. This way you can even set it in your .ini file.

toscawidgets.framework.resource_variant = min in your ini to set to minified files, for instance.

comment:3 Changed 9 years ago by chrisz

  • Status changed from closed to reopened
  • Priority changed from high to normal
  • Resolution fixed deleted

We should also add this to tg-docs and maybe put default entries into the .ini files (e.g. debug in develop, minified in deployment).

comment:4 Changed 9 years ago by percious

  • Status changed from reopened to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.