Bug in variant resources serve

0 views
Skip to first unread message

Christophe de VIENNE

unread,
Oct 22, 2009, 12:51:17 PM10/22/09
to toscawidge...@googlegroups.com
Hi,

I found a bug (and the solution to it) with the new variant resources handling.
Let's say we have two links :

l1 = JSLink(modname="mod1", filename={'normal': 'path1', 'debug': 'path1debug'})
l2 = JSLink(modname="mod2", filename={'normal': 'path2'})

In this case, we have no 'debug' variant for the 'mod2' module.
If we switch to the 'debug' variant, the ResourcesApp.is_resource function will not find any mod2 path (causing a 404 error), because the the __iter__ implementation :

155     def __iter__(self):
156         return self.iter_variant(self.ACTIVE_VARIANT)

The iteration will never returns the 'mod2' paths.d

A possible fix is to change __iter__ to :

155     def __iter__(self):
156         return chain(self.iter_variant(self.ACTIVE_VARIANT),
157             self.iter_variant(self.DEFAULT_VARIANT))

I attached a hg bundle.

Thanks,

Christophe

fix_noactivevariant_issue.bundle

Diez B. Roggisch

unread,
Oct 22, 2009, 8:29:18 PM10/22/09
to toscawidge...@googlegroups.com
Christophe de VIENNE schrieb:

Thanks. I will apply that ASAP.

Diez

Reply all
Reply to author
Forward
0 new messages