From 394f0498a569b90c7f74cd74965b3f6eef86c209 Mon Sep 17 00:00:00 2001 From: opi Date: Sun, 27 Mar 2016 16:41:54 +0200 Subject: [PATCH] [enh] Use named arguments for user_unknown string. --- locales/en.json | 2 +- src/yunohost/app.py | 5 +---- src/yunohost/user.py | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/locales/en.json b/locales/en.json index e2d12cbf9..5859a10f2 100644 --- a/locales/en.json +++ b/locales/en.json @@ -195,7 +195,7 @@ "mail_domain_unknown" : "Unknown mail address domain '{domain:s}'", "mail_alias_remove_failed" : "Unable to remove mail alias '{mail:s}'", "mail_forward_remove_failed" : "Unable to remove mail forward '{mail:s}'", - "user_unknown" : "Unknown user", + "user_unknown" : "Unknown user: {user:s}", "system_username_exists" : "Username already exists in the system users", "user_creation_failed" : "Unable to create user", "user_created" : "User successfully created", diff --git a/src/yunohost/app.py b/src/yunohost/app.py index fc2aab19d..1659aa793 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -626,10 +626,7 @@ def app_addaccess(auth, apps, users=[]): try: user_info(auth, allowed_user) except MoulinetteError: - # FIXME: Add username keyword in user_unknown - logger.warning('{0}{1}'.format( - m18n.g('colon', m18n.n('user_unknown')), - allowed_user)) + logger.warning(m18n.n('user_unknown', user=allowed_user)) continue allowed_users.add(allowed_user) diff --git a/src/yunohost/user.py b/src/yunohost/user.py index 4cc77632d..ec7dd539c 100644 --- a/src/yunohost/user.py +++ b/src/yunohost/user.py @@ -275,7 +275,7 @@ def user_update(auth, username, firstname=None, lastname=None, mail=None, # Populate user informations result = auth.search(base='ou=users,dc=yunohost,dc=org', filter='uid=' + username, attrs=attrs_to_fetch) if not result: - raise MoulinetteError(errno.EINVAL, m18n.n('user_unknown')) + raise MoulinetteError(errno.EINVAL, m18n.n('user_unknown', user=username)) user = result[0] # Get modifications from arguments @@ -381,7 +381,7 @@ def user_info(auth, username): if result: user = result[0] else: - raise MoulinetteError(errno.EINVAL, m18n.n('user_unknown')) + raise MoulinetteError(errno.EINVAL, m18n.n('user_unknown', user=username)) result_dict = { 'username': user['uid'][0],