summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8cae786)
raw | patch | inline | side by side (parent: 8cae786)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 18 Sep 2002 22:26:07 +0000 (22:26 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 18 Sep 2002 22:26:07 +0000 (22:26 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1193 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 a85ae01d8982c06e94e6dbfba69dd67e16a2234d..9caa9457fc7258aeebe5aba037e2fd2339b40094 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
backends
- we now verify instance attributes on instance open and throw a useful error
if they're not all there
+- sf 611217 ] menu() has problems when labelprop==None
2002-09-13 0.5.0 beta2
index 5ab27bd844283a352d97ecf634df3f5388421a3d..f78313b3c349da7ec30f5f6f4f86269c8a0edbd9 100644 (file)
s = ''
l.append(_('<option %svalue="-1">- no selection -</option>')%s)
for optionid in options:
- option = linkcl.get(optionid, k)
+ # get the option value, and if it's None use an empty string
+ option = linkcl.get(optionid, k) or ''
+
+ # figure if this option is selected
s = ''
if optionid == self._value:
s = 'selected '
+
+ # figure the label
if showid:
lab = '%s%s: %s'%(self._prop.classname, optionid, option)
else:
lab = option
+
+ # truncate if it's too long
if size is not None and len(lab) > size:
lab = lab[:size-3] + '...'
+
+ # and generate
lab = cgi.escape(lab)
l.append('<option %svalue="%s">%s</option>'%(s, optionid, lab))
l.append('</select>')
sort_on = ('+', linkcl.labelprop())
options = linkcl.filter(None, conditions, sort_on, (None, None))
for optionid in options:
- option = linkcl.get(optionid, k)
+ # get the option value, and if it's None use an empty string
+ option = linkcl.get(optionid, k) or ''
+
+ # figure if this option is selected
s = ''
if value in [optionid, option]:
s = 'selected '
+
+ # figure the label
if showid:
lab = '%s%s: %s'%(self._prop.classname, optionid, option)
else:
lab = option
+
+ # truncate if it's too long
if size is not None and len(lab) > size:
lab = lab[:size-3] + '...'
if additional:
for propname in additional:
m.append(linkcl.get(optionid, propname))
lab = lab + ' (%s)'%', '.join(map(str, m))
+
+ # and generate
lab = cgi.escape(lab)
l.append('<option %svalue="%s">%s</option>'%(s, optionid, lab))
l.append('</select>')
l = ['<select multiple name="%s" size="%s">'%(self._name, height)]
k = linkcl.labelprop(1)
for optionid in options:
- option = linkcl.get(optionid, k)
+ # get the option value, and if it's None use an empty string
+ option = linkcl.get(optionid, k) or ''
+
+ # figure if this option is selected
s = ''
if optionid in value or option in value:
s = 'selected '
+
+ # figure the label
if showid:
lab = '%s%s: %s'%(self._prop.classname, optionid, option)
else:
lab = option
+ # truncate if it's too long
if size is not None and len(lab) > size:
lab = lab[:size-3] + '...'
if additional:
for propname in additional:
m.append(linkcl.get(optionid, propname))
lab = lab + ' (%s)'%', '.join(m)
+
+ # and generate
lab = cgi.escape(lab)
l.append('<option %svalue="%s">%s</option>'%(s, optionid,
lab))
d['env'] = e
return '''
form: %(form)s
-url: %(url)r
base: %(base)r
classname: %(classname)r
template: %(template)r