Configuring ToscaWidget resource variants

0 views
Skip to first unread message

Christoph Zwerschke

unread,
Jan 4, 2010, 5:47:43 AM1/4/10
to turbo...@googlegroups.com
ToscaWidgets 0.9.8 supports "variants" for Javascript and CSS resources
(minified, packed or debug versions of the js/css files).

Does anybody know how to configure the default variant in TurboGears?
I'd like to have the debug variant in my development environment, and
the packed variant in my production environment.

-- Christoph

Diez B. Roggisch

unread,
Jan 4, 2010, 2:56:32 PM1/4/10
to turbo...@googlegroups.com
Christoph Zwerschke schrieb:

There is no config-file-way for now, partially because TW lacks an
option in the make_middleware-call, partially because TG2 doesn't
propagate configuration settings in the AppConfig-class.

So IMHO the easiest way is to set this value inside config.middleware
like this:


import tw.api

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


Regards,

Diez

Christoph Zwerschke

unread,
Jan 5, 2010, 7:36:38 AM1/5/10
to turbo...@googlegroups.com
Am 04.01.2010 20:56, schrieb Diez B. Roggisch:
> Christoph Zwerschke schrieb:

> There is no config-file-way for now, partially because TW lacks an
> option in the make_middleware-call, partially because TG2 doesn't
> propagate configuration settings in the AppConfig-class.
>
> So IMHO the easiest way is to set this value inside config.middleware
> like this:
>
> import tw.api
>
> tw.api.resources.registry.ACTIVE_VARIANT =
> app_conf.get("tw.resource_variant",
> tw.api.resource.registry.DEFAULT_VARIANT)

Thanks Diez, that works. I wonder whether we should add this to the
default quickstart template, together with appropriate settings of
tw.resource_variant in development.ini and depolyment.ini?

-- Christoph

Diez B. Roggisch

unread,
Jan 5, 2010, 8:37:38 AM1/5/10
to turbo...@googlegroups.com

Most certainly yes. I also would like to see that AppConf actually passes down
app_conf to the tw.api.make_middleware-call. Thus other config-options could
be set, e.g. require_once, serve_resources and so on.

Diez

Christoph Zwerschke

unread,
Jan 7, 2010, 5:23:39 PM1/7/10
to turbo...@googlegroups.com
Am 05.01.2010 14:37 schrieb Diez B. Roggisch:
> Most certainly yes. I also would like to see that AppConf actually passes down
> app_conf to the tw.api.make_middleware-call. Thus other config-options could
> be set, e.g. require_once, serve_resources and so on.

Good idea. I've created ticket #2439 for this now.

-- Christoph

Reply all
Reply to author
Forward
0 new messages