umh, this could spell trouble for many user folder implementations where retrieving the user contents requires more work, like database or LDAP-lookups. the "getUserNames" or "getUsers" methods on those kinds of user folders should be used sparingly ;) all you really need to do is to take the new user name and use it to call getUser on the user folder. if the result is "None" there is no user of that name in the respective user folder. otherwise you get back a user object. if self.acl_users.getUser( new_user_name ): return 'Error: User Exists' else: self.acl_users._addUser( username, password, confirmpass, liste_role, 0 ) jens On Friday, August 17, 2001, at 04:30 , Sylvain Boureliou wrote:
Sorry for the last empty Re:
Hi Juan
You can try :
confirmation = "ok"
for x in self.acl_users.getUserNames(): if (x==username): confirmation="error" break
if confirmation=='ok': self.acl_users._addUser(username,password,confirmpass,liste_role, 0)
Sylvain
-----Message d'origine----- De : zope-admin@zope.org [mailto:zope-admin@zope.org]De la part de Juan Garcia Garcia Envoyé : vendredi 17 août 2001 10:11 À : zope@zope.org Objet : [Zope] How to know if a user already exists?
I have a form with two fields, one to write a login and the other for the password. When the anonymous user pushs the submit button I will create a new user with the id and password written. But I want to know, before doing this action, if the login already exists in the folder 'acl_users'. I tried with the function 'has_key' but it didn't work. If anyone has do it before, please send me the answer.
Thank you.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )