Hi,

I could solve my problem now.

It was: 

Frank Barknecht hat gesagt: // Frank Barknecht wrote:

> But if I try to create another user, this fails with: 
>   
>   
>   File "/dos/ibm/hdc18/f/src/python/webware/workdir/thehood/Main.py", line 71, in 
>Create
>     newUser = self.hood.add(name, passwd)
>   File "/dos/ibm/hdc18/f/src/python/webware/workdir/thehood/Main.py", line 22, in add
>     newUser = self.mgr.createUser(name, password)
>   File "./UserKit/UserManager.py", line 146, in createUser
>   File "./UserKit/UserManagerToFile.py", line 109, in addUser
>   File "./UserKit/UserManager.py", line 152, in addUser
> AssertionError

This AssertionError always occured, if I tried to create a second user.
The problem was, that I did initialize the UserManager in a wrong way.

I did this:

        def __init__(self, user_dir):
                if not path.isdir(user_dir):
                        raise "Not a directory: %s" % user_dir
                else: 
                        # create manager
                        self.mgr = UserManagerToFile()
                        # set user directory
                        self.mgr.setUserDir(user_dir)

According to the UserManagerToFile docstring, I thought this would be
enough, but in fact it wasn't! I needed to add a call to
initNextSerialNum(), because otherwise the serialNum is only
initialized for the current working directory. So if one changes the
UserDir later with mgr.setUserDir(user_dir), the manager needs to
re-initialize the serial numbers. 

Granted, I was blind, because the docstring for setUserDir points out,
that this would be necessary. 

But what about changing setUserDir() to do this itself. Actually I
can't imagine a use case that wants to set the userdir without also
reading in the last serial numbers.

ciao
-- 
 Frank Barknecht                               _ ______footils.org__


-------------------------------------------------------
This sf.net email is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ad.doubleclick.net/clk;4729346;7592162;s?http://www.sun.com/javavote
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to