[ZCM] [ZC] 216/ 2 Comment "dtml-tree sort is random on non-existent property"

Collector: Zope Bugs and Patches ... zope-coders@zope.org
Mon, 11 Feb 2002 20:22:05 -0500


Issue #216 Update (Comment) "dtml-tree sort is random on non-existent property"
 Status Pending, Zope/bug medium
To followup, visit:
  http://collector.zope.org/Zope/216

==============================================================
= Comment - Entry #2 by ajung on Feb 11, 2002 8:22 pm

Ok, the cleanst solution would be in this case to raise an 
exception but I don't like to see a default alphabetical order
when the sort-by column does not exist. 

- aj 
________________________________________
= Request - Entry #1 by Anonymous User on Feb 11, 2002 6:36 pm

Take this Tree example:

<dtml-tree Content single="true" branches_expr="objectValues('Folder')" sort="displayorder">
<dtml-if "meta_type=='Folder'">
<a href="<dtml-var BASE0><dtml-var "Content.rootpath"><dtml-var tree-item-url>" target="main">
<dtml-var title_or_id></a> <dtml-else>
</dtml-if>
</dtml-tree>

In this example, the property 'displayorder' is used to sort the important root level folders. If the property 'displayorder' is missing, as it is on all subfolders, objects are sorted randomly each time tree is loaded. Perhaps, if the property is missing, ignore the sort altogether, or a default alphabetic or folder-order sort, or even throw and error?

Note: this is a re-submission.

aj wrote:
>When there is no such attribute then you can not sort by 
>this attribute. So this behaviour is more logical than
>implicitly using another sorting order.

When is unexpected random behaviour ever *logical*? Please address this with a more reasonable explanation.

Thanks.

==============================================================