mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[mod] don't use exception when not needed
This commit is contained in:
parent
d14bc31771
commit
c14acc0fae
1 changed files with 2 additions and 5 deletions
|
@ -115,11 +115,8 @@ def user_create(auth, username, firstname, lastname, mail, password,
|
||||||
})
|
})
|
||||||
|
|
||||||
# Validate uniqueness of username in system users
|
# Validate uniqueness of username in system users
|
||||||
try:
|
all_existing_usernames = {x.pw_name for x in pwd.getpwall()}
|
||||||
pwd.getpwnam(username)
|
if username in all_existing_usernames:
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
raise MoulinetteError(errno.EEXIST, m18n.n('system_username_exists'))
|
raise MoulinetteError(errno.EEXIST, m18n.n('system_username_exists'))
|
||||||
|
|
||||||
# Check that the mail domain exists
|
# Check that the mail domain exists
|
||||||
|
|
Loading…
Add table
Reference in a new issue