Skip to content

Commit c7c4563

Browse files
author
Roche Compaan
committed
Fixed display of mutlilink properties...
...when using the template functions, menu and plain.
1 parent bab2220 commit c7c4563

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Feature:
2828
. #517734 ] web header customisation is obscure
2929
. All messages sent to the nosy list are now encoded as
3030
quoted-printable before they are sent.
31+
. Fixed display of mutlilink properties when using the template
32+
functions, menu and plain.
3133

3234
Fixed:
3335
. Clean up mail handling, multipart handling.

roundup/htmltemplate.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: htmltemplate.py,v 1.83 2002-02-27 04:14:31 richard Exp $
18+
# $Id: htmltemplate.py,v 1.84 2002-03-29 19:41:48 rochecompaan Exp $
1919

2020
__doc__ = """
2121
Template engine.
@@ -110,7 +110,10 @@ def do_plain(self, property, escape=0):
110110
elif isinstance(propclass, hyperdb.Multilink):
111111
linkcl = self.db.classes[propclass.classname]
112112
k = linkcl.labelprop()
113-
value = ', '.join(value)
113+
labels = []
114+
for v in value:
115+
labels.append(linkcl.get(v, k))
116+
value = ', '.join(labels)
114117
else:
115118
value = _('Plain: bad propclass "%(propclass)s"')%locals()
116119
if escape:
@@ -284,7 +287,7 @@ def do_menu(self, property, size=None, height=None, showid=0):
284287
for optionid in options:
285288
option = linkcl.get(optionid, k)
286289
s = ''
287-
if optionid in value:
290+
if optionid in value or option in value:
288291
s = 'selected '
289292
if showid:
290293
lab = '%s%s: %s'%(propclass.classname, optionid, option)
@@ -313,7 +316,7 @@ def do_menu(self, property, size=None, height=None, showid=0):
313316
for optionid in options:
314317
option = linkcl.get(optionid, k)
315318
s = ''
316-
if optionid == value:
319+
if value in [optionid, option]:
317320
s = 'selected '
318321
if showid:
319322
lab = '%s%s: %s'%(propclass.classname, optionid, option)
@@ -1111,6 +1114,9 @@ def render(self, form):
11111114

11121115
#
11131116
# $Log: not supported by cvs2svn $
1117+
# Revision 1.83 2002/02/27 04:14:31 richard
1118+
# Ran it through pychecker, made fixes
1119+
#
11141120
# Revision 1.82 2002/02/21 23:11:45 richard
11151121
# . fixed some problems in date calculations (calendar.py doesn't handle over-
11161122
# and under-flow). Also, hour/minute/second intervals may now be more than

test/test_htmltemplate.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# but WITHOUT ANY WARRANTY; without even the implied warranty of
99
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1010
#
11-
# $Id: test_htmltemplate.py,v 1.11 2002-02-21 23:11:45 richard Exp $
11+
# $Id: test_htmltemplate.py,v 1.12 2002-03-29 19:41:48 rochecompaan Exp $
1212

1313
import unittest, cgi, time
1414

@@ -97,7 +97,7 @@ def testPlain_link(self):
9797
self.assertEqual(self.tf.do_plain('link'), 'the key1')
9898

9999
def testPlain_multilink(self):
100-
self.assertEqual(self.tf.do_plain('multilink'), '1, 2')
100+
self.assertEqual(self.tf.do_plain('multilink'), 'the key1, the key2')
101101

102102

103103
# def do_field(self, property, size=None, showid=0):
@@ -344,6 +344,11 @@ def suite():
344344

345345
#
346346
# $Log: not supported by cvs2svn $
347+
# Revision 1.11 2002/02/21 23:11:45 richard
348+
# . fixed some problems in date calculations (calendar.py doesn't handle over-
349+
# and under-flow). Also, hour/minute/second intervals may now be more than
350+
# 99 each.
351+
#
347352
# Revision 1.10 2002/02/21 06:57:39 richard
348353
# . Added popup help for classes using the classhelp html template function.
349354
# - add <display call="classhelp('priority', 'id,name,description')">

0 commit comments

Comments
 (0)