diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2011-04-13 01:17:58 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2011-04-13 01:17:58 -0400 |
| commit | f8933f67e9f08fd96a67031e675e422dbeea5c87 (patch) | |
| tree | b6750e25d657bb7d82a40f06173553f2acba0486 /server/user.py | |
| parent | 3b8849a0437b56454a71b60976d9eb040235c242 (diff) | |
| download | alias-f8933f67e9f08fd96a67031e675e422dbeea5c87.tar.gz | |
Rewrite of the object classes and various fixes
- splitted the Object class into ObjectWriter and ObjectReader
- in the UserHandler class, the root object is now automatically
created when registering with the component server.
- use of os.join.path everywhere to make the code more robust
Diffstat (limited to 'server/user.py')
| -rw-r--r-- | server/user.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/server/user.py b/server/user.py index a2ca732..3c47dbe 100644 --- a/server/user.py +++ b/server/user.py @@ -2,6 +2,8 @@ import os import os.path import shutil import hashlib +import logging +from object import ObjectWriter class UserHandler: @@ -10,12 +12,10 @@ class UserHandler: def register(self, name): userDir = self.root + '/' + name - self.hash = hashlib.sha1(name).hexdigest() - root_node = userDir + '/' + self.hash[:2] + '/' + self.hash[2:] - os.makedirs(root_node) - os.utime(root_node + '/permissions') - os.utime(root_node + '/childs') - os.utime(root_node + '/object') + if os.path.exists(userDir): + logging.error("User {} path already exists".format(name)) + os.mkdir(userDir) + ObjectWriter(name) def registered(self, name): return os.path.exists(self.root + '/' + name) |
