[ZCM] [ZC] 2260/ 5 Resolve "Examples/FileLibrary sort feature broken"

"Collector: Zope Bugs, Features, and Patches ..." <[email protected]> Thu, 10 May 2007 13:06:13 -0400
Newsgroups gmane.comp.web.zope.devel.collector-monitor
Message-ID <[email protected]>
Issue #2260 Update (Resolve) "Examples/FileLibrary sort feature broken"
 Status Resolved, Zope/bug low
To followup, visit:
  http://www.zope.org/Collectors/Zope/2260

==============================================================
= Resolve - Entry #5 by ajung on May 10, 2007 1:06 pm

 Status: Accepted => Resolved

Fixed on the 2.9, 2.10 branches and trunk
________________________________________
= Edit - Entry #4 by ajung on Mar 12, 2007 1:35 pm

 Changes: submitter email, edited transcript, importance (medium => low)
________________________________________
= Assign - Entry #3 by ajung on Mar 12, 2007 1:34 pm

 Status: Pending => Accepted

 Supporters added: andreasjung

The Example package is unmaintained and likely subject to be removed in Zope 2.11
________________________________________
= Comment - Entry #2 by yolabingo on Jan 8, 2007 12:52 pm

Of course, after drinking coffee I realized that simply changing

 else:
    new_reverse=not reverse
to

 else:
     new_reverse=int(not reverse)

would be much nicer and preserve the logic.  But the logic does not appear to be necessary, so

 else:
     new_reverse=1

should suffice.

________________________________________
= Request - Entry #1 by yolabingo on Jan 8, 2007 12:39 pm

While playing with the example file library, I found that it would not reverse-sort:
"You can click on the column names to sort the files. If you click twice on a column
then the files are sorted in reverse order."

Clicking twice on a column produced the following error:

> An error was encountered while publishing this resource.
> Error Type: ValueError
> Error Value: An integer was expected in the value 'True'

The following ugly modification to Examples/FileLibrary/getLink fixes the problem:

> """
> Returns a URL which gives sorting commands in the query string.
> """
> url=context.REQUEST.URL0
> if new_sort != sort:
>    new_reverse=0
> else:
>    new_reverse=not reverse
>+ if new_reverse:
>+    new_reverse = 1
>+ else:
>+     new_reverse = 0
>return "%s?sort=%s&reverse:int=%s" % (url, new_sort, new_reverse)
==============================================================