本文整理汇总了Python中models.Activity.push_activity方法的典型用法代码示例。如果您正苦于以下问题:Python Activity.push_activity方法的具体用法?Python Activity.push_activity怎么用?Python Activity.push_activity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Activity
的用法示例。
在下文中一共展示了Activity.push_activity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: schedule_master_activity
# 需要导入模块: from models import Activity [as 别名]
# 或者: from models.Activity import push_activity [as 别名]
def schedule_master_activity(sid):
logger.warning('schedule_master_activity sid:%s' % str(sid))
s_act = col_get(SCHEDULEDACTIVITY_, {"_id" : ObjectId(sid)}, {}, 'one')
if not s_act:
logger.warning('Scheduled activity %s doesnt exist, exiting' % str(s_act))
return
logger.warning('schedule_master_activity creating activity %s' % str(s_act))
activity = Activity.create_activity(suggester=None, text=s_act.get('text'), expiry = s_act.get('expiry'), visibility='n', status=Activity.MASTER, confirm_msg = s_act.get('details'), where = s_act.get('where'), when = s_act.get('when'), network = s_act.get('network'))
logger.warning('schedule_master_activity sid:%s aid:%s, removing scheduled act' % (str(sid), str(activity.get('_id'))))
col_remove(SCHEDULEDACTIVITY_, {"_id" : ObjectId(sid)})
logger.warning('schedule_master_activity sid:%s aid:%s pushing to: %s' % (str(sid), str(activity.get('_id')), s_act.get('network')))
Activity.push_activity(activity['_id'])
pull_default_hrs = get_eta(hours=settings.DEFAULT_USER_PULL_HOURS)
pull_confirmed_hours = get_eta(hours=settings.CONFIRMED_USER_PULL_AFTER_WHEN_HOURS)
logger.warning('schedule_master_activity sid:%s expire_activity_default:%s pull_default:%s pull_confirmed_activity_default:%s' % (str(sid), s_act.get('expiry').strftime('%Y-%m-%d %H:%M'), pull_default_hrs.strftime('%Y-%m-%d %H:%M'), pull_confirmed_hours.strftime('%Y-%m-%d %H:%M')))
expire_activity_default.apply_async(args=[activity["_id"]], eta=s_act.get('expiry'))
pull_default.apply_async(args=[activity["_id"]], eta=pull_default_hrs)
# pull_confirmed_activity_default.apply_async(args=[activity["_id"]], eta=pull_confirmed_hours)
#Then we kick off the normal notifications
notification_tasks.new_activity(activity["_id"])
示例2: push_activity
# 需要导入模块: from models import Activity [as 别名]
# 或者: from models.Activity import push_activity [as 别名]
def push_activity(aid):
"""
Calls the push activity method to populate in users timelines
"""
total_ids = Activity.push_activity(aid)
pushed_to = []
if settings.RECORD_ACTIVITY_PUSH:
for attr in ['friends', 'fofs', 'groups', 'network']:
l = total_ids.get(attr, [])
pushed_to = pushed_to + l
for f in l:
logger.warning('push_activity aid:%s %s:%s' % (str(aid), attr, str(f)))
#Send a 'gc' notification to tell the app to refresh get_content if it's open
notification_tasks.push_gc(pushed_to)
return "Pushing activity %s" % aid