def update_user(user_id, u_name, u_email, u_account, is_disabled, modifier_id): user = User() user.u_name = u_name user.u_email = u_email user.u_account = u_account user.modified_time = dtutil.utcnow() user.is_disabled = is_disabled user.put(modifier_id) return user
def create_user(u_name, u_email, u_account, u_password, is_disabled, modifier_id): length = conf.get_useraccount_length() length = map(int, length) if (len(u_account) < length[0] or len(u_account) > length[1]): raise LengthError("core_label_accountname", length[0], length[1]) length = conf.get_userpassword_length() length = map(int, length) if (len(u_password) < length[0] or len(u_password) > length[1]): raise LengthError("core_label_userpassword", length[0], length[1]) user = User() user.u_name = u_name user.u_email = u_email user.u_account = u_account user.u_password = encrypt_password(u_password) user.is_disabled = is_disabled user.put(modifier_id) return user