@@ -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
17041692class 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