Skip to content

Commit cbacf13

Browse files
author
Richard Jones
committed
merge from HEAD
1 parent 1b80a8b commit cbacf13

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
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+
45
2005-??-?? 0.8.1
56
Fixed:
67
- replaced MutlilinkIterator with multilinkGenerator (thanks Bob Ippolito)
8+
- fixed broken csv import in roundup.admin module
9+
- fixed braino in HTMLClass.filter() (sf bug 1124213)
710

811

912
2005-02-16 0.8.0

roundup/cgi/templating.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ def filter(self, request=None, filterspec={}, sort=(None,None),
614614
check = self._db.security.hasPermission
615615
userid = self._client.userid
616616

617-
l = [HTMLItem(self._client, self.classname, x)
617+
l = [HTMLItem(self._client, self.classname, id)
618618
for id in self._klass.filter(None, filterspec, sort, group)
619619
if check('View', userid, self.classname, itemid=id)]
620620
return l
@@ -1688,18 +1688,6 @@ def menu(self, size=None, height=None, showid=0, additional=[],
16881688
# def checklist(self, ...)
16891689

16901690

1691-
def multilinkGenerator(classname, client, values):
1692-
id = -1
1693-
check = client.db.security.hasPermission
1694-
userid = client.userid
1695-
while 1:
1696-
id += 1
1697-
if id >= len(values):
1698-
raise StopIteration
1699-
value = values[id]
1700-
if check('View', userid, classname, itemid=value):
1701-
yield HTMLItem(client, classname, value)
1702-
17031691

17041692
class MultilinkHTMLProperty(HTMLProperty):
17051693
''' Multilink HTMLProperty
@@ -1723,18 +1711,26 @@ def __getattr__(self, attr):
17231711
''' no extended attribute accesses make sense here '''
17241712
raise AttributeError, attr
17251713

1714+
def multilinkGenerator(self, values):
1715+
'''Used to iterate over only the View'able items in a class.'''
1716+
check = self._db.security.hasPermission
1717+
userid = self._client.userid
1718+
classname = self._prop.classname
1719+
for value in values:
1720+
if check('View', userid, classname, itemid=value):
1721+
yield HTMLItem(self._client, classname, value)
1722+
17261723
def __iter__(self):
17271724
''' iterate and return a new HTMLItem
17281725
'''
1729-
return multilinkGenerator(self._prop.classname, self._client,
1730-
self._value)
1726+
return self.multilinkGenerator(self._value)
17311727

17321728
def reverse(self):
17331729
''' return the list in reverse order
17341730
'''
17351731
l = self._value[:]
17361732
l.reverse()
1737-
return multilinkGenerator(self._prop.classname, self._client, l)
1733+
return self.multilinkGenerator(l)
17381734

17391735
def sorted(self, property):
17401736
''' Return this multilink sorted by the given property '''

0 commit comments

Comments
 (0)