Mercurial > hg > bitsyblog
diff bitsyblog/user.py @ 102:bc08a00a7d93
make user creation work again, wip
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 23 Feb 2014 16:50:06 -0800 |
parents | dd4abe56edf7 |
children | 67e01fc5e360 |
line wrap: on
line diff
--- a/bitsyblog/user.py Sat Feb 01 13:19:26 2014 -0800 +++ b/bitsyblog/user.py Sun Feb 23 16:50:06 2014 -0800 @@ -1,5 +1,5 @@ """ -module for bitsyblog users +bitsyblog users """ import os @@ -24,6 +24,7 @@ def get(self, key, default=None): return self.settings.get(key, default) + class BitsyUsers(object): """abstract class for bitsyblog user management""" @@ -48,6 +49,7 @@ return passwords ### interface methods to be specified by the child class + def new(self, name, password): """create a new user""" @@ -105,11 +107,15 @@ for i in css_files ] return retval + ### interfaces for BitsyUsers def new(self, name, password): """create a new user account""" + # XXX this shouldn't use HTTP exceptions + # instead, the web handler should listen for exceptions + # and it should raise HTTP exceptions if name in self.users(): raise exc.HTTPForbidden("The name %s is already taken" % name).exception @@ -122,6 +128,7 @@ if name in urls: raise exc.HTTPForbidden("The name '%s' is already used for a url" % user).exception + # create user directory home = self.home(name) os.mkdir(home) pw_file = file(self.pw_file(name), 'w')