Re: [Archetypes-devel] Re: auto-sortable folders

Wichert Akkerman <[email protected]>
Newsgroups gmane.comp.web.zope.plone.devel,gmane.comp.web.zope.plone.archetypes.devel
Message-ID <[email protected]>
Previously Encolpe Degoute wrote:
> You should sort on three attributes:
>  sort: ('created', 'alpha', 'alphanum', 'modified', 'reverse_created',
>          'reverse_alpha', 'reverse_alphanum', 'reverse_modified')
>  sort_method: a method without argument
>  sort_expression: any TALES expression with a reasonnable context

This is way more complex than what users are familiar with. 99% of all
sorting will be on a single attribute and be ascending or descending.
The other 1% will use two or more attributes in a specific order. If you
want pseudocode that becomes:

  class SortKey(interface):
     attribute = Attribute("name of the attribute on which we sort")
     ascending = Attribute("sort ascending. if false use descending sort")
    
  class SortOrder(interface):
     keys = Attribute("list of sort keys used for soring")

     def sortlist(objects):
        "sort the list of objects according to our sort keys"

Wichert.

-- 
Wichert Akkerman <[email protected]>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.