Skip to content

Commit 76a6c47

Browse files
author
Richard Jones
committed
'Make a Copy' failed with more than one person in nosy list [SF#1906147]
1 parent 151ffd3 commit 76a6c47

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

CHANGES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
This file contains the changes to the Roundup system over time. The entries
22
are given with the most recent entry first.
33

4+
2008-03-01 1.4.5
5+
Fixed:
6+
- 'Make a Copy' failed with more than one person in nosy list (sf #1906147)
7+
8+
49
2008-03-01 1.4.4
510
Fixed:
611
- Security fixes (thanks Roland Meister)

roundup/cgi/templating.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2134,7 +2134,7 @@ def handleListCGIValue(value):
21342134
value = value.value.strip()
21352135
if not value:
21362136
return []
2137-
return value.split(',')
2137+
return [v.strip() for v in value.split(',')]
21382138

21392139
class HTMLRequest(HTMLInputMixin):
21402140
"""The *request*, holding the CGI form and environment.

test/test_templating.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ class TemplatingTestCase(unittest.TestCase):
1212
def setUp(self):
1313
self.form = FieldStorage()
1414
self.client = MockNull()
15-
self.client.db = MockDatabase()
15+
self.client.db = db = MockDatabase()
16+
db.security.hasPermission = lambda *args, **kw: True
1617
self.client.form = self.form
1718

1819
class HTMLDatabaseTestCase(TemplatingTestCase):
@@ -69,6 +70,24 @@ def get(entry, key):
6970
self.assertEqual(lookupKeys(shrubbery, 'spam', ['ok','2']), ['ok',
7071
'eggs'])
7172

73+
class HTMLClassTestCase(TemplatingTestCase) :
74+
75+
def test_multilink(self):
76+
"""`lookup` of an item will fail if leading or trailing whitespace
77+
has not been stripped.
78+
"""
79+
def lookup(key) :
80+
self.assertEqual(key, key.strip())
81+
return "User%s"%key
82+
self.form.list.append(MiniFieldStorage("nosy", "1, 2"))
83+
nosy = hyperdb.Multilink("user")
84+
self.client.db.classes = dict \
85+
( issue = MockNull(getprops = lambda : dict(nosy = nosy))
86+
, user = MockNull(get = lambda id, name : id, lookup = lookup)
87+
)
88+
cls = HTMLClass(self.client, "issue")
89+
cls["nosy"]
90+
7291
'''
7392
class HTMLPermissions:
7493
def is_edit_ok(self):
@@ -243,6 +262,7 @@ def test_suite():
243262
suite = unittest.TestSuite()
244263
suite.addTest(unittest.makeSuite(HTMLDatabaseTestCase))
245264
suite.addTest(unittest.makeSuite(FunctionsTestCase))
265+
suite.addTest(unittest.makeSuite(HTMLClassTestCase))
246266
return suite
247267

248268
if __name__ == '__main__':

0 commit comments

Comments
 (0)