mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Do not test result more than once
This commit is contained in:
parent
493fa402e1
commit
78aa5ddf83
1 changed files with 4 additions and 8 deletions
|
@ -158,11 +158,11 @@ def alias_info(auth, alias):
|
|||
|
||||
result = auth.search('ou=aliases,dc=yunohost,dc=org', filter, alias_attrs)
|
||||
|
||||
if result:
|
||||
alias = result[0]
|
||||
else:
|
||||
if not result:
|
||||
raise MoulinetteError(errno.EINVAL, m18n.n('alias_unknown'))
|
||||
|
||||
alias = result[0]
|
||||
|
||||
result_dict = {
|
||||
'alias': alias['mail'][0]
|
||||
}
|
||||
|
@ -170,11 +170,7 @@ def alias_info(auth, alias):
|
|||
if len(alias['maildrop']) > 0:
|
||||
result_dict['mail-forward'] = alias['maildrop'][0:]
|
||||
|
||||
if result:
|
||||
return result_dict
|
||||
else:
|
||||
raise MoulinetteError(167, m18n.n('alias_info_failed'))
|
||||
|
||||
return result_dict
|
||||
|
||||
def _ensure_ldap_ou_is_created(auth):
|
||||
"""
|
||||
|
|
Loading…
Add table
Reference in a new issue