def register(self, username, new_username): check = self.find_reg_user(new_username) if isinstance(check, NullUser): registered = RegisteredUser(new_username) user = self.find_user(username) registered.cart = user.cart self.reg_user_list[new_username] = registered return True else: return False
def register(self, username, new_username): ans, data = self.find_reg_user(new_username) if ans is False: # isinstance(check, NullUser): registered = RegisteredUser(new_username) # change fined_user() return vals res, user = self.find_user(username) if res is True: registered.cart = user.cart self.reg_user_list[new_username] = registered return True, { 'data': 'Thank you for joining us ' + new_username + '! To continue as ' + new_username + ' please login.' } return res, user else: return False, { 'error_msg': 'User name: ' + new_username + ' is already in use. Please choose another user name.' }