mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[mod] autopep8
This commit is contained in:
parent
03d83b7166
commit
f52b805bf4
2 changed files with 67 additions and 62 deletions
|
@ -184,8 +184,8 @@ def user_create(auth, username, firstname, lastname, mail, password,
|
|||
with open('/etc/ssowat/conf.json.persistent', 'w+') as f:
|
||||
json.dump(ssowat_conf, f, sort_keys=True, indent=4)
|
||||
|
||||
except IOError: pass
|
||||
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
if auth.add(rdn, attr_dict):
|
||||
# Invalidate passwd to take user creation into account
|
||||
|
@ -229,8 +229,10 @@ def user_delete(auth, username, purge=False):
|
|||
|
||||
# Update SFTP user group
|
||||
memberlist = auth.search(filter='cn=sftpusers', attrs=['memberUid'])[0]['memberUid']
|
||||
try: memberlist.remove(username)
|
||||
except: pass
|
||||
try:
|
||||
memberlist.remove(username)
|
||||
except:
|
||||
pass
|
||||
if auth.update('cn=sftpusers,ou=groups', {'memberUid': memberlist}):
|
||||
if purge:
|
||||
subprocess.call(['rm', '-rf', '/home/{0}'.format(username)])
|
||||
|
@ -411,9 +413,12 @@ def user_info(auth, username):
|
|||
else:
|
||||
raise MoulinetteError(167, m18n.n('user_info_failed'))
|
||||
|
||||
|
||||
def _convertSize(num, suffix=''):
|
||||
for unit in ['K', 'M', 'G', 'T', 'P', 'E', 'Z']:
|
||||
if abs(num) < 1024.0:
|
||||
return "%3.1f%s%s" % (num, unit, suffix)
|
||||
|
||||
num /= 1024.0
|
||||
|
||||
return "%.1f%s%s" % (num, 'Yi', suffix)
|
||||
|
|
Loading…
Add table
Reference in a new issue