[Zope] add user from python problem

garry saddington garry at schoolteachers.co.uk
Thu Feb 15 12:34:10 EST 2007


The following script adds a new folder with a user folder inside it and
then adds a user to the user folder. It works fine but the new user is
unable to log in until I go to the ZMI and go to change the user
password. I do not need to do anything more than press the change button
on this page for the user to be then able to log in using the password
specified in the script. Given that I will be adding up to 2000 users at
a time with an ammended version of this script, this could become a
little inconvenient. Am I doing something wrong?

Zope Version 
(Zope 2.9.0, python 2.4.2, win32) 
Python Version 
2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] 
System Platform 
win32 



        roles='Manager'
        domains=[]
        password='go' 
        confirm='go'
        name='BogeySmith'
        forms='7L'
        forms_obj = getattr(context, forms)
        forms_obj.manage_addFolder(name)
        
        path = str(forms+'/'+name)
        path_obj = context.restrictedTraverse(path)
        path_obj.manage_addUserFolder()
        path2 = str(forms+'/'+name)
        path_obj2 = context.restrictedTraverse(path2)
        userfolder = getattr(path_obj2, 'acl_users')
        userfolder.userFolderAddUser(name, password,roles,domains)

regards
garry




More information about the Zope mailing list