[Zope] RE: [Zope-CMF] Access to other members properties

Kevin Carlson khcarlso@bellsouth.net
Mon, 12 Aug 2002 22:41:32 -0400


You can also create an external python script to call private methods.

-----Original Message-----
From: zope-cmf-admin@zope.org [mailto:zope-cmf-admin@zope.org]On Behalf
Of John_Knutson@candle.com
Sent: Friday, August 09, 2002 12:53 PM
To: Tres Seaver
Cc: zope-cmf@zope.org
Subject: Re: [Zope-CMF] Access to other members properties



Tres,

That was one of the approaches that I tried. However, since that methjod is
private, I needed to create a protected method in Membership to invoke it
and when I called that, I got an Attribute Error from somewhere.

Maybe I should just create something based on searchMemberDataContents
without any security at all. I'll try that and see how it goes.

Cheers,
John Knutson
Candle Corporation



                    Tres Seaver
                    <tseaver@zope        To:     John
Knutson/CAM/Candle@Candle
                    .com>                cc:     zope-cmf@zope.org
                                         Subject:     Re: [Zope-CMF] Access
to other members properties
                    09/08/2002
                    15:09







On Fri, 2002-08-09 at 07:21, John_Knutson@candle.com wrote:
> OK, I can now set my 'notify' property. Now I need to create a list of
the
> email addresses of all of the members that have the 'notify'property set.
>
> I've tried all sorts of things without success. This, for example returns
> the 'notify' property when 'member' is the logged-on user but returns
> Attribute Error for any other name:
>
> <dtml-var expr="member.getProperty('notify')">
>
> I've even tried adding new methods to the Membership and MemberData tools
> without success.
>
> Can anyone direct me in the right direction?

CMFCore.Membershiptool.MembershipTool has a utility method which might
give you a good start:


    security.declarePrivate( 'searchMemberDataContents' )
    def searchMemberDataContents( self, search_param, search_term ):
        """ Search members """
        res = []

        if search_param == 'username':
            search_param = 'id'

        for user_wrapper in self._members.values():
            searched = getattr( user_wrapper, search_param, None )
            if searched is not None and string.find( searched,
                   search_term ) != -1:
                res.append( { 'username' : getattr( user_wrapper, 'id' )
                            , 'email' : getattr( user_wrapper,
                                                 'email', '' )
                            }
                          )

        return res

While this is hardly as general as it could be, it does sketch out the
access method for searching memberdata.

Tres.
--
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com





_______________________________________________
Zope-CMF maillist  -  Zope-CMF@zope.org
http://lists.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests