def get(self): api = BoruvkaUserApi(self.dao) users = api.list_users() users_list = [] for user in users: user_dict = {} for key, value in vars(user).items(): if key.startswith("_") or key == 'password': continue user_dict[key] = value users_list.append(user_dict) response = Response( body=dumps(users_list), content_type="application/json", ) return response
def get(self): api = BoruvkaUserApi(self.dao) users = api.list_users() setting_query = BoruvkaSettingQuery(self.dao) users_settings = {} for user in users: users_settings[user.id] = setting_query.get_user_settings(user.id) # TODO: move translations handling to BaseController translation = list(self.request.accept_language)[0] view = BoruvkaUserListView( translation=translation, ) view._full = not self.request.is_xhr view._users = users view._users_settings = users_settings response = Response() response.body = view.render() return response