Mercurial > p > roundup > code
changeset 3199:0c400f46bce0 maint-0.8
merge from HEAD
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 16 Feb 2005 21:53:57 +0000 |
| parents | afb69535a3a1 |
| children | 291652465de4 |
| files | CHANGES.txt roundup/cgi/templating.py |
| diffstat | 2 files changed, 15 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Wed Feb 16 14:16:51 2005 +0000 +++ b/CHANGES.txt Wed Feb 16 21:53:57 2005 +0000 @@ -1,9 +1,12 @@ This file contains the changes to the Roundup system over time. The entries are given with the most recent entry first. + 2005-??-?? 0.8.1 Fixed: - replaced MutlilinkIterator with multilinkGenerator (thanks Bob Ippolito) +- fixed broken csv import in roundup.admin module +- fixed braino in HTMLClass.filter() (sf bug 1124213) 2005-02-16 0.8.0
--- a/roundup/cgi/templating.py Wed Feb 16 14:16:51 2005 +0000 +++ b/roundup/cgi/templating.py Wed Feb 16 21:53:57 2005 +0000 @@ -614,7 +614,7 @@ check = self._db.security.hasPermission userid = self._client.userid - l = [HTMLItem(self._client, self.classname, x) + l = [HTMLItem(self._client, self.classname, id) for id in self._klass.filter(None, filterspec, sort, group) if check('View', userid, self.classname, itemid=id)] return l @@ -1688,18 +1688,6 @@ # def checklist(self, ...) -def multilinkGenerator(classname, client, values): - id = -1 - check = client.db.security.hasPermission - userid = client.userid - while 1: - id += 1 - if id >= len(values): - raise StopIteration - value = values[id] - if check('View', userid, classname, itemid=value): - yield HTMLItem(client, classname, value) - class MultilinkHTMLProperty(HTMLProperty): ''' Multilink HTMLProperty @@ -1723,18 +1711,26 @@ ''' no extended attribute accesses make sense here ''' raise AttributeError, attr + def multilinkGenerator(self, values): + '''Used to iterate over only the View'able items in a class.''' + check = self._db.security.hasPermission + userid = self._client.userid + classname = self._prop.classname + for value in values: + if check('View', userid, classname, itemid=value): + yield HTMLItem(self._client, classname, value) + def __iter__(self): ''' iterate and return a new HTMLItem ''' - return multilinkGenerator(self._prop.classname, self._client, - self._value) + return self.multilinkGenerator(self._value) def reverse(self): ''' return the list in reverse order ''' l = self._value[:] l.reverse() - return multilinkGenerator(self._prop.classname, self._client, l) + return self.multilinkGenerator(l) def sorted(self, property): ''' Return this multilink sorted by the given property '''
