[Zope-CMF] Programmatically set member properties in batch

vsbabu@vsbabu.org vsbabu@vsbabu.org
Tue, 7 May 2002 12:22:08 -0500


Hello,

I've an Excel sheet with a bunch of users and their properties. I need to precreate these users and their "My Stuff" folder and set their email ids. The precreating users, my stuff etc were pretty easy.

How do I go about writing a script that sets their email ids?

--- sample script ---
userids = ['ourceo','ourvp','director']
for userids in userid:
    member = container.portal_membership.getMemberById(userid)
    if member is not None:
        member.email = userid + '@mycompany.com'
        print member.getProperty('email','no email set')
return printed
----------------
member.email won't work. getProperty works properly. I saw that there is a
function setMemberProperties(mapping), but that is declared private. Short
of declaring this as public temporarily, then running my script, then making it private again, are there any other easy solutions?


member.email = XX works if member is getAuthenticatedUser().

As far as possible, I'd like to run this script once and set every one up
instead of looking for first login and then setting it up.


Thanks in advance
-vsb