[Zope-Checkins] CVS: Zope2 - SortEx.py:1.1.2.2

andreas@serenade.digicool.com andreas@serenade.digicool.com
Wed, 16 May 2001 08:40:12 -0400


Update of /cvs-repository/Zope2/lib/python/sequence
In directory serenade:/tmp/cvs-serv18733

Modified Files:
      Tag: ajung-dtml-sort
	SortEx.py 
Log Message:
added doc string



--- Updated File SortEx.py in package Zope2 --
--- SortEx.py	2001/05/15 20:34:23	1.1.2.1
+++ SortEx.py	2001/05/16 12:40:11	1.1.2.2
@@ -94,6 +94,35 @@
 
 
 def sort(sequence, sort=(), _=None, mapping=0):
+    """
+    - sequence is a sequence of objects to be sorted
+
+    - sort is a sequence of tuples (key,func,direction)
+      that define the sort order:
+
+      - key is the name of an attribute to sort the objects by
+
+      - func is the name of a comparison function. This parameter is
+        optional
+
+        allowed values:
+
+        - "cmp" -- the standard comparison function (default)
+ 
+        - "nocase" -- case-insensitive comparison
+ 
+        - "strcoll" or "locale" -- locale-aware string comparison
+
+        - "strcoll_nocase" or "locale_nocase" -- locale-aware case-insensitive
+           string comparison
+ 
+        - "xxx" -- a user-defined comparison function
+ 
+      - direction -- defines the sort direction for the key (optional).
+        (allowed values: "asc" (default) , "desc")
+    """      
+
+
     need_sortfunc = 0
     if sort:
         for s in sort:
@@ -166,6 +195,8 @@
     for k, client in s:
          sequence.append(client)
     return sequence
+
+SortEx = sort
 
 
 basic_type={type(''): 1, type(0): 1, type(0.0): 1, type(()): 1, type([]): 1,