diff roundup/cgi/templating.py @ 1322:c0546b95aad1

finished off handling of retired flag in filter() [SF#635260] (bugfix in mailgw unit tests for x-roundup-loop too)
author Richard Jones <richard@users.sourceforge.net>
date Tue, 10 Dec 2002 00:46:55 +0000
parents 3758a5af985f
children 80eef084069a
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Tue Dec 10 00:23:36 2002 +0000
+++ b/roundup/cgi/templating.py	Tue Dec 10 00:46:55 2002 +0000
@@ -971,7 +971,11 @@
         else:
             s = ''
         l.append(_('<option %svalue="-1">- no selection -</option>')%s)
-        # XXX if the current value is retired, then list it explicitly
+
+        # make sure we list the current value if it's retired
+        if self._value and self._value not in options:
+            options.insert(0, self._value)
+
         for optionid in options:
             # get the option value, and if it's None use an empty string
             option = linkcl.get(optionid, k) or ''
@@ -1018,7 +1022,11 @@
         else:  
             sort_on = ('+', linkcl.labelprop())
         options = linkcl.filter(None, conditions, sort_on, (None, None))
-        # XXX if the current value is retired, then list it explicitly
+
+        # make sure we list the current value if it's retired
+        if self._value and self._value not in options:
+            options.insert(0, self._value)
+
         for optionid in options:
             # get the option value, and if it's None use an empty string
             option = linkcl.get(optionid, k) or ''
@@ -1139,7 +1147,12 @@
         height = height or min(len(options), 7)
         l = ['<select multiple name="%s" size="%s">'%(self._name, height)]
         k = linkcl.labelprop(1)
-        # XXX if any of the current values are retired, then list them
+
+        # make sure we list the current values if they're retired
+        for value in self._value:
+            if value not in options:
+                options.insert(0, value)
+
         for optionid in options:
             # get the option value, and if it's None use an empty string
             option = linkcl.get(optionid, k) or ''

Roundup Issue Tracker: http://roundup-tracker.org/