On 6 Dec 2001 at 16:57, Romain Slootmaekers wrote:

> In retrospect, I should have posted only 1 message instead of 3 :)

And I should have submitted a patch to the collector instead of posting here. :-(

Just not sure what is the "right" way to do this, here's my first pass:

def guarded_reduce(f,seq,**kw):
    skip_unauthorized = kw.get('skip_unauthorized')
    v = getSecurityManager().validate
    safelist = []
    if kw.has_key('init'):
        i = kw['init']
        if v(accessed=kw,name='init',value=i):
        elif not skip_unauthorized:
            raise Unauthorized, 'unauthorized access to init'
    for el in seq:
        if v(seq, seq, None, el):
        elif not skip_unauthorized:
            raise Unauthorized, 'unauthorized access to element'
    return reduce(f,safelist)

Brad Clements,                [EMAIL PROTECTED]   (315)268-1000
http://www.murkworks.com                          (315)268-9812 Fax
netmeeting: ils://ils.murkworks.com               AOL-IM: BKClements

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to