本文整理汇总了Python中models.users.Users.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Users.delete方法的具体用法?Python Users.delete怎么用?Python Users.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.users.Users
的用法示例。
在下文中一共展示了Users.delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: User
# 需要导入模块: from models.users import Users [as 别名]
# 或者: from models.users.Users import delete [as 别名]
class User(Controller):
_users = None
def __init__(self):
super(User, self).__init__()
self._users = Users()
def get(self, id):
self._permissions.signed()
data = self._users.get(id)
if "password" in data:
del data["password"]
return data
def add(self, data):
self._permissions.signed()
return self._users.add(data)
def edit(self, id, data):
self._permissions.signed()
return self._users.edit(id, data)
def delete(self, id):
self._permissions.signed()
return self._users.delete(id)
def all(self, filter):
self._permissions.signed()
data = self._users.all(filter)
for item in data:
if "password" in item:
del item["password"]
return data
def current(self):
return self._users.check(session.get("email"), session.get("password"))
def signin(self, data):
user = self._users.check(data.get("email"), data.get("password"))
if "email" in user and "password" in user:
session["email"] = user["email"]
session["password"] = user["password"]
return self.current()
def signout(self):
session.pop('email', None)
session.pop('password', None)
return self.current()