[Zope] #tree & reverse sort

Achim Gorski Achim Gorski <gorski@sgi.com>
Thu, 23 Sep 1999 18:15:13 +0200 (CEST)


This problem is also in Zope Version 2.0.1 !! It wasn't corrected.

- Achim


On Sep 8, 14:55, Martijn Pieters wrote:
> Subject: Re: [Zope] #tree & reverse sort
> At 13:55 08/09/99 , Achim Gorski wrote:
>
> >Hello Zope users!
> >
> >
> >The following construct works in Zope-2.0.0b6:
> ><!--#tree dox leaves="objectValues(['Folder', 'DTML Document'])" sort=id
> >reverse-->
> >
> >I've now switched to Zope-2.0.0 and the above reverse sort produces an
> >AttributeError. I still can do reverse sort with the #in tag!
> >What's different in 2.0.0 or how can I do a reverse sort with the #tree
tag??
> >
> >Thanks for your advice.
> >
> >- Achim
>
> Congratulations, you have found a bug,
>
> When Chris subtly changed the way the reverse is performed in both in and
> tree tags, he made a mistake in the tree tag, and must have missed it.
>
> The Tree class uses two TreeDisplay Module functions (note: not member
> methods of the Tree class) to display your tree, and within those functions
> 'self' is the same as the _.this() object. In case of a DTML Method, it's
> the Method's parent in the acquisition path.
>
> Chris, however, thought it would be the Tree class itself. That class has a
> new method, reverse_items, which he thought he could call with
> self.reverse_items. What happens is that that method is looked up in your
> acquisition tree, where it is not present.
>
> Solution:
>
> Remove the reverse_tems method at line 158 and change
> items=self.reverse_items(items) (line 345) to:
> items=list(items)
> items.reverse()
>
> Warning: I did not test this, but I am sure it'll work.
>
> I'll report this to the Collector.
>
> --
> Martijn Pieters, Web Developer
> | Antraciet http://www.antraciet.nl
> | Tel: +31-35-7502100 Fax: +31-35-7502111
> | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
> | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
> ------------------------------------------
>-- End of excerpt from Martijn Pieters



-- 
  Silicon Graphics GmbH    |  Email: Achim Gorski <gorski@sgi.com>
 Frankfurter Str. 720-726  |  Phone: +49-2203-9312-24
  D-51145 Koeln, Germany   |  VM   : +330-8891
   Mail-Stop:  IDE-3160    |  Fax  : +49-2203-9312-20