From 0a35f757e9bab98fd5451b2c48cfb66060582eb8 Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 24 Feb 2016 14:46:28 +0800 Subject: [PATCH] modify(function arg) only for writing style MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改函数使用kwarg --- juser/user_api.py | 2 +- juser/views.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/juser/user_api.py b/juser/user_api.py index 63bd4bd10..335dd2d96 100644 --- a/juser/user_api.py +++ b/juser/user_api.py @@ -183,7 +183,7 @@ def server_del_user(username): bash('userdel -r %s' % username) -def get_display_msg(user, password, ssh_key_pwd, send_mail_need=False): +def get_display_msg(user, password='', ssh_key_pwd='', send_mail_need=False): if send_mail_need: msg = u'添加用户 %s 成功! 用户密码已发送到 %s 邮箱!' % (user.name, user.email) else: diff --git a/juser/views.py b/juser/views.py index d57b0fbde..ba5f90708 100644 --- a/juser/views.py +++ b/juser/views.py @@ -175,7 +175,7 @@ def user_add(request): ssh_key_pwd=ssh_key_pwd, is_active=is_active, date_joined=datetime.datetime.now()) - server_add_user(username, ssh_key_pwd) + server_add_user(username=username, ssh_key_pwd=ssh_key_pwd) user = get_object(User, username=username) if groups: user_groups = [] @@ -192,7 +192,7 @@ def user_add(request): else: if MAIL_ENABLE and send_mail_need: user_add_mail(user, kwargs=locals()) - msg = get_display_msg(user, password, ssh_key_pwd, send_mail_need) + msg = get_display_msg(user, password=password, ssh_key_pwd=ssh_key_pwd, send_mail_need=send_mail_need) return my_render('juser/user_add.html', locals(), request)