homes: plus de généricité & /home-adh/x/xlogin
This commit is contained in:
parent
de45237b50
commit
20a6ee6afb
6 changed files with 15 additions and 14 deletions
|
@ -32,13 +32,13 @@ import lc_ldap.filter2 as filter
|
|||
if __name__ == '__main__':
|
||||
# Lecture de la redirection courante
|
||||
def redirection_read(uid):
|
||||
forward = open('/home/%s/.forward' %uid ,'r')
|
||||
forward = open(os.path.expanduser('~%s/.forward' %uid) ,'r')
|
||||
print forward.read()
|
||||
forward.close()
|
||||
return
|
||||
# Modification de la redirection
|
||||
def redirection_write(ligne,uid):
|
||||
forward = open('/home/%s/.forward' %uid ,'w')
|
||||
forward = open(os.path.expanduser('~%s/.forward' %uid),'w')
|
||||
forward.write('%s' %ligne)
|
||||
forward.close()
|
||||
return
|
||||
|
|
|
@ -2538,8 +2538,7 @@ class Adherent(BaseProprietaire):
|
|||
if mailexist(login):
|
||||
raise ValueError(u"Login existant ou correspondant à un alias mail.", 1)
|
||||
|
||||
# <!> b2moo: à fixer pour les homes
|
||||
home = '/home/' + login
|
||||
home = '/home/%s/%s' % (login[0], login)
|
||||
if os.path.exists(home):
|
||||
raise ValueError(u'Création du compte impossible : home existant', 1)
|
||||
|
||||
|
@ -2877,7 +2876,7 @@ class Club(BaseProprietaire):
|
|||
# la 2ème vérif est pour vérifier que ce n'est pas la ML du club
|
||||
raise ValueError(u"Login existant ou correspondant à un alias mail.", 1)
|
||||
|
||||
home = '/home/' + login.replace('-', '/', 1)
|
||||
home = '/home/%s/%s' % (login[0], login.replace('-', '/', 1))
|
||||
if os.path.exists(home):
|
||||
raise ValueError(u'Création du compte impossible : home existant', 1)
|
||||
|
||||
|
|
|
@ -488,7 +488,7 @@ def adher_details(adher) :
|
|||
if len(adher.gpgFingerprint()) > 0:
|
||||
f += u"\n".join([coul(u'Fingerprint GPG : ', 'gras') + u"%s" % (i) for i in adher.gpgFingerprint()])+"\n"
|
||||
try:
|
||||
forward = file("/home/%s/.forward" % adher.compte()).readlines()
|
||||
forward = file(os.path.join(adher.home(), ".forward")).readlines()
|
||||
if len(forward) > 1:
|
||||
forward = forward[0].strip() + u" ...\n"
|
||||
elif len(forward) == 1:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue