[Grok-dev] Re: Question about viewlets
faassen at startifact.com
Thu May 1 17:39:24 EDT 2008
Wichert Akkerman wrote:
> Previously Martijn Faassen wrote:
>> Note that grok.order() is a bit more advanced than you might suspect at
>> first. The rules for grokcore.component.util.sort_components:
>> 1. if grok.order() is used explicitly with a numeric argument, that will
>> be used for sorting. Objects without explicit order will sort before this.
>> 2. if grok.order() is used without an argument, things are ordered in
>> definition order. If multiple modules are in play, they'll be sorted by
>> dotted module name.
>> 3. if grok.order() is altogether missing, unfortunately some python
>> limitations make it impossible to use implicit ordering as in 2. Instead
>> we sort on class name to have at least some consistent ordering.
> Perhaps a fallback on grok.title would be more logical, since you are
> generating output for users instead of coders.
That's a good idea. Of course grok.title() is not typically present in
the case of viewlets as far as I know, but it's one we should look into
when we get to menus. That said, we defined grok.title() as falling back
on the class name if it isn't present, so it would preserve the same
behavior if we do that.
Wichert, could you create a launchpad issue for this so we won't forget?
More information about the Grok-dev