modify(function arg) only for writing style

修改函数使用kwarg
pull/78/head
ibuler 2016-02-24 14:46:28 +08:00
parent f60a896926
commit 0a35f757e9
2 changed files with 3 additions and 3 deletions

View File

@ -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:

View File

@ -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)