summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9740479)
raw | patch | inline | side by side (parent: 9740479)
author | stefan <stefan@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 19 Feb 2009 21:59:14 +0000 (21:59 +0000) | ||
committer | stefan <stefan@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 19 Feb 2009 21:59:14 +0000 (21:59 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4145 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/cgi/templating.py | patch | blob | history |
index 61a30fecdc3e87876e0d3fd90a31c769e25a21c0..e03310ad7bf394b6ad912fbd57aa6c1f646fc9b9 100644 (file)
if value and value not in options:
options.insert(0, value)
+ if additional:
+ additional_fns = []
+ props = linkcl.getprops()
+ for propname in additional:
+ prop = props[propname]
+ if isinstance(prop, hyperdb.Link):
+ cl = self._db.getclass(prop.classname)
+ labelprop = cl.labelprop()
+ fn = lambda optionid: cl.get(linkcl.get(optionid,
+ propname),
+ labelprop)
+ else:
+ fn = lambda optionid: linkcl.get(optionid, propname)
+ additional_fns.append(fn)
+
for optionid in options:
# get the option value, and if it's None use an empty string
option = linkcl.get(optionid, k) or ''
lab = lab[:size-3] + '...'
if additional:
m = []
- for propname in additional:
- m.append(linkcl.get(optionid, propname))
- lab = lab + ' (%s)'%', '.join(map(str, m))
+ for fn in additional_fns:
+ m.append(str(fn(optionid)))
+ lab = lab + ' (%s)'%', '.join(m)
# and generate
lab = cgi.escape(self._(lab))
if val not in options:
options.insert(0, val)
+ if additional:
+ additional_fns = []
+ props = linkcl.getprops()
+ for propname in additional:
+ prop = props[propname]
+ if isinstance(prop, hyperdb.Link):
+ cl = self._db.getclass(prop.classname)
+ labelprop = cl.labelprop()
+ fn = lambda optionid: cl.get(linkcl.get(optionid,
+ propname),
+ labelprop)
+ else:
+ fn = lambda optionid: linkcl.get(optionid, propname)
+ additional_fns.append(fn)
+
for optionid in options:
# get the option value, and if it's None use an empty string
option = linkcl.get(optionid, k) or ''
lab = lab[:size-3] + '...'
if additional:
m = []
- for propname in additional:
- m.append(linkcl.get(optionid, propname))
+ for fn in additional_fns:
+ m.append(str(fn(optionid)))
lab = lab + ' (%s)'%', '.join(m)
# and generate