本文整理汇总了Python中models.User.User.all_users方法的典型用法代码示例。如果您正苦于以下问题:Python User.all_users方法的具体用法?Python User.all_users怎么用?Python User.all_users使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.User.User
的用法示例。
在下文中一共展示了User.all_users方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: broadcast_info
# 需要导入模块: from models.User import User [as 别名]
# 或者: from models.User.User import all_users [as 别名]
def broadcast_info(cls, title, message):
''' Send a info notification to all users '''
event_uuid = unicode(uuid4())
cls.__anonymous__(title, message, INFO, event_uuid)
for user in User.all_users():
cls.__create__(user, title, message, INFO, event_uuid)
return event_uuid
示例2: broadcast_success
# 需要导入模块: from models.User import User [as 别名]
# 或者: from models.User.User import all_users [as 别名]
def broadcast_success(cls, title, message):
''' Send a success notification to all users '''
event_uuid = unicode(uuid4())
cls.__anonymous__(title, message, SUCCESS, event_uuid)
for user in User.all_users():
cls.__create__(user, title, message, SUCCESS, event_uuid)
return event_uuid
示例3: broadcast_custom
# 需要导入模块: from models.User import User [as 别名]
# 或者: from models.User.User import all_users [as 别名]
def broadcast_custom(cls, title, message, icon):
''' Send a custom notification to all users '''
event_uuid = unicode(uuid4())
cls.__anonymous__(title, message, CUSTOM, event_uuid, icon)
for user in User.all_users():
cls.__create__(user, title, message, CUSTOM, event_uuid, icon)
return event_uuid
示例4: broadcast_warning
# 需要导入模块: from models.User import User [as 别名]
# 或者: from models.User.User import all_users [as 别名]
def broadcast_warning(cls, title, message):
''' Send a warning notification to all users '''
event_uuid = unicode(uuid4())
cls.__anonymous__(title, message, WARNING, event_uuid)
for user in User.all_users():
cls.__create__(user, title, message, WARNING, event_uuid)
return event_uuid
示例5: create_broadcast
# 需要导入模块: from models.User import User [as 别名]
# 或者: from models.User.User import all_users [as 别名]
def create_broadcast(cls, team, title, message, icon=None):
if not options.global_notification and team:
cls.create_team(team, title, message, icon)
else:
for user in User.all_users():
notification = cls._create(user, title, message, icon)
dbsession.add(notification)
dbsession.commit()
示例6: render_page
# 需要导入模块: from models.User import User [as 别名]
# 或者: from models.User.User import all_users [as 别名]
def render_page(self, errors=None):
''' Render page with extra arguments '''
if errors is not None and not isinstance(errors, list):
errors = [str(errors), ]
user = self.get_current_user()
targets = filter(
lambda target: target not in user.team.members, User.all_users())
self.render('upgrades/swat.html',
targets=targets,
user_bribes=Swat.ordered_by_user_id(user.id),
errors=None)
示例7: leaderboard
# 需要导入模块: from models.User import User [as 别名]
# 或者: from models.User.User import all_users [as 别名]
def leaderboard(cls, order_by='passwords'):
'''
Creates an ordered list of tuples, for each user and the
number of password they've cracked
'''
orders = {'passwords': 1, 'cash': 2}
leaders = []
for user in User.all_users():
if 0 < cls.count_cracked_by(user.id):
leaders.append((user,
cls.count_cracked_by(user.id),
sum(cls.by_cracker_id(user.id)),
))
if order_by not in orders: order_by = 'passwords'
leaders.sort(key=lambda stats: stats[orders[order_by]], reverse=True)
return leaders
示例8: create_broadcast
# 需要导入模块: from models.User import User [as 别名]
# 或者: from models.User.User import all_users [as 别名]
def create_broadcast(cls, title, message, icon=None):
for user in User.all_users():
notification = cls._create(user, title, message, icon)
dbsession.add(notification)
dbsession.commit()