[Zope-CMF] get a members name / 'project' object into amember folder

Dan L. Pierson dan@control.com
Fri, 22 Jun 2001 09:09:35 -0400


--On Friday, June 22, 2001 12:15:15 PM +0200 Cyrille Giquello 
<cyrille@ktaland.com> wrote:

> Hi all,
> I'm joinning this thread to profite of the subject to ask a question about
> portal_membership.
>
> You're using portal_membership.getMemberById(id).getUserName()
> but wich method we've to use to get information with the username.
>
> I get the username, but I can't call
>     getHomeFolder(id=None, verifyPermission=0):
> because it need the Id.
>
> Why there isn't any method to get information or Id from username ???

Well, for one thing, usernames aren't guaranteed to be unique.  The only 
things I can
suggest are to use listMembers (don't trust me on that name) and do a 
linear search (ick)
or to write Python code to build your own index.  A PersistentMapping 
should be OK if the
number of members is small enough otherwise you might need to play with 
BTrees (someone
with more knowledge of the internals than me will have to define "small 
enough" :-)).