First, you might want to take Danny Adairs advice (as posted to the list), as he is correct in that if you have quite a few users, his method will work much faster when checking if a user exists. Also, the parameters that should be in the REQUEST for manage_users are: name password confirm roles domains So you will have to either 1. Change your form to submit these same variable names, or, 2. do a context.REQUEST.set('name', context.REQUEST.form['Username']) etc, for each item you submit in the form and then pass REQUEST on to manage_users. After making sure the right variables are defined in the request, your first attempt: context.acl_users.manage_users('Add', context.REQUEST) should work for you. On Tue, 2001-10-30 at 00:47, Rob Foster wrote:
Adam,
Thanks for the code... I tried it out and it works great... However, I realized that I was doing the check correctly. What I WASN'T doing right was the "add user here" part... here are the various lines of code that I tried under the "else:" with no luck... A little more help with possibly some explanation as to what's happening would be great...
Here are the various lines I've tried:
NUMBER ONE ATTEMPT: context.acl_users.manage_users('Add', context.REQUEST)
NUMBER TWO ATTEMPT: self.acl_users._addUser(username,password,confirmpass,liste_role,0)
NUMBER THREE ATTEMPT: userfolder.manage_users(submit='Add', REQUEST=user_info)
I got these bits of code from off various tutorials... Sometimes it really sucks being a newbie :)
Thanks again, Rob
---------------------------------------------------------------------------------------------
On Monday, October 29, 2001, at 10:14 PM, M. Adam Kendall wrote:
basically, you'll want to do something along the lines of:
request = context.REQUEST response = request.RESPONSE if request.form['Username'] in context.acl_users.getUserNames(): response.redirect('/UserAlreadyExists.html') else: # add user here
On Mon, 2001-10-29 at 12:11, Rob Foster wrote: Here's the setup:
I'm trying to add users to my site by having them fill out a form with the following fields:
Username Password Confirm (password confirmation)
I want the form to post to a python script that will check the folder and do a redirect to another document depending on what happens... I don't know Python that well. I've tried doing it in dtml with no results.
Can someone help me with a little example code or at least point me to a product that does this? Thanks in advance. -Rob