summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b108de6)
raw | patch | inline | side by side (parent: b108de6)
author | jlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 20 Nov 2003 15:20:21 +0000 (15:20 +0000) | ||
committer | jlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 20 Nov 2003 15:20:21 +0000 (15:20 +0000) |
alphabetically (sf feature 790512).
- Extract find_sort_key method.
- Use nested scopes in make_sort_function.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2000 57a73879-2fb5-44c3-a270-3262357dd7e2
- Extract find_sort_key method.
- Use nested scopes in make_sort_function.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2000 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/cgi/templating.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index 8c1c0077f2a08cf7b84bf991a539f9adf3905632..d4555d5c4d6d186509361e8281b2cbb10277e4a8 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
- Existing trackers (ie. live ones) may be used as templates for new
trackers - the TEMPLATE-INFO.txt name entry has the tracker's dir name
appended (so the demo tracker's template name is "classic-demo")
+- Always sort MultilinkHTMLProperty in the correct order, usually
+ alphabetically (sf feature 790512).
Fixed:
- mysql documentation fixed to note requirement of 4.0+ and InnoDB
- Added note to upgrading doc for detectors fix in 0.6.2
- Added script to help migrating queries from pre-0.6 trackers
- Fixed "documentation" of getnodeids in roundup.hyperdb
-- Added flush() to DevNull (sf bug #835365)
+- Added flush() to DevNull (sf bug 835365)
- Fixed javascript for help window for only one checkbox case
- Date arithmetic was utterly broken, and has been for a long time.
Date +/- Interval now works, and Date - Date also works (produces
index 062462bff6e7c1a58d7b25615c047d9405ad8cfb..1c461bf631ac81e906c0ffeca6e8b4b31deb4cdf 100644 (file)
+from __future__ import nested_scopes
+
import sys, cgi, urllib, os, re, os.path, time, errno, mimetypes
from roundup import hyperdb, date, rcsv
'''
value = self._value
- # sort function
- sortfunc = make_sort_function(self._db, self._prop.classname)
-
linkcl = self._db.getclass(self._prop.classname)
l = ['<select name="%s">'%self._formname]
k = linkcl.labelprop(1)
Also be iterable, returning a wrapper object like the Link case for
each entry in the multilink.
'''
+ def __init__(self, *args, **kwargs):
+ HTMLProperty.__init__(self, *args, **kwargs)
+ if self._value:
+ self._value.sort(make_sort_function(self._db, self._prop.classname))
+
def __len__(self):
''' length of the multilink '''
return len(self._value)
def field(self, size=30, showid=0):
''' Render a form edit field for the property
'''
- sortfunc = make_sort_function(self._db, self._prop.classname)
linkcl = self._db.getclass(self._prop.classname)
value = self._value[:]
- if value:
- value.sort(sortfunc)
# map the id to the label property
if not linkcl.getkey():
showid=1
'''
value = self._value
- # sort function
- sortfunc = make_sort_function(self._db, self._prop.classname)
-
linkcl = self._db.getclass(self._prop.classname)
- if linkcl.getprops().has_key('order'):
- sort_on = ('+', 'order')
- else:
- sort_on = ('+', linkcl.labelprop())
- options = linkcl.filter(None, conditions, sort_on, (None,None))
+ sort_on = ('+', find_sort_key(linkcl))
+ options = linkcl.filter(None, conditions, sort_on)
height = height or min(len(options), 7)
l = ['<select multiple name="%s" size="%s">'%(self._formname, height)]
k = linkcl.labelprop(1)
'''Make a sort function for a given class
'''
linkcl = db.getclass(classname)
- if linkcl.getprops().has_key('order'):
- sort_on = 'order'
- else:
- sort_on = linkcl.labelprop()
- def sortfunc(a, b, linkcl=linkcl, sort_on=sort_on):
+ sort_on = find_sort_key(linkcl)
+ def sortfunc(a, b):
return cmp(linkcl.get(a, sort_on), linkcl.get(b, sort_on))
return sortfunc
+def find_sort_key(linkcl):
+ if linkcl.getprops().has_key('order'):
+ return 'order'
+ else:
+ return linkcl.labelprop()
+
def handleListCGIValue(value):
''' Value is either a single item or a list of items. Each item has a
.value that we're actually interested in.