File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 22Customising Roundup
33===================
44
5- :Version: $Revision: 1.149 $
5+ :Version: $Revision: 1.150 $
66
77.. This document borrows from the ZopeBook section on ZPT. The original is at:
88 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -1848,6 +1848,12 @@ pretty Date properties - render the date as "dd Mon YYYY" (eg. "19
18481848 format (eg. "yesterday")
18491849menu only on Link and Multilink properties - render a form select
18501850 list for this property
1851+ sorted only on Multilink properties - produce a list of the linked
1852+ items sorted by some property, for example::
1853+
1854+ python:context.files.sorted('creation')
1855+
1856+ Will list the files by upload date.
18511857reverse only on Multilink properties - produce a list of the linked
18521858 items in reverse order
18531859isset returns True if the property has been set to a value
Original file line number Diff line number Diff line change @@ -1648,6 +1648,12 @@ def __getitem__(self, num):
16481648 value = self ._value [num ]
16491649 return HTMLItem (self ._client , self ._prop .classname , value )
16501650
1651+ def sorted (self , property ):
1652+ ''' Return this multilink sorted by the given property '''
1653+ value = list (self ._value [num ])
1654+ value .sort (lambda a ,b :cmp (a [property ], b [property ]))
1655+ return value
1656+
16511657 def __contains__ (self , value ):
16521658 ''' Support the "in" operator. We have to make sure the passed-in
16531659 value is a string first, not a HTMLProperty.
You can’t perform that action at this time.
0 commit comments