本文整理汇总了Python中r2.lib.emailer.reject_promo函数的典型用法代码示例。如果您正苦于以下问题:Python reject_promo函数的具体用法?Python reject_promo怎么用?Python reject_promo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了reject_promo函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reject_promo
def reject_promo(thing, reason = ""):
"""
Reject promotion and set its status as rejected
Here, we use unpromote so that we can also remove a promotion from
the queue if it has become promoted.
"""
unpromote(thing, status = STATUS.rejected)
promotion_log(thing, "status update: rejected. Reason: '%s'" % reason)
emailer.reject_promo(thing, reason)
示例2: reject_promotion
def reject_promotion(link, reason=None):
was_live = is_promoted(link)
update_promote_status(link, PROMOTE_STATUS.rejected)
# Send a rejection email (unless the advertiser requested the reject)
if not c.user or c.user._id != link.author_id:
emailer.reject_promo(link, reason=reason)
if was_live:
all_live_promo_srnames(_update=True)
示例3: reject_promotion
def reject_promotion(link, reason=None, notify_why=True):
if is_rejected(link):
return
was_live = is_promoted(link)
update_promote_status(link, PROMOTE_STATUS.rejected)
if reason:
PromotionLog.add(link, "rejected: %s" % reason)
# Send a rejection email (unless the advertiser requested the reject)
if not c.user or c.user._id != link.author_id:
emailer.reject_promo(link, reason=(reason if notify_why else None))
if was_live:
all_live_promo_srnames(_update=True)
示例4: reject_promotion
def reject_promotion(link, reason = None):
PromotionLog.add(link, 'status update: rejected')
# update the query queue
# Since status is updated first,
# if make_daily_promotions happens to run
# while we're doing work here, it will correctly exclude it
set_promote_status(link, PROMOTE_STATUS.rejected)
links, = get_live_promotions([SponsorBoxWeightings.ALL_ADS_ID])[0]
if link._fullname in links:
PromotionLog.add(link, 'Marked promotion for rejection')
queue_changed_promo(link, "rejected")
# Send a rejection email (unless the advertiser requested the reject)
if not c.user or c.user._id != link.author_id:
emailer.reject_promo(link, reason = reason)
示例5: reject_promotion
def reject_promotion(link, reason = None):
promotion_log(link, "status update: rejected")
# update the query queue
set_status(link, STATUS.rejected)
# check to see if this link is a member of the current live list
links, weighted = get_live_promotions()
if link._fullname in links:
links.remove(link._fullname)
for k in list(weighted.keys()):
weighted[k] = [(lid, w) for lid, w in weighted[k]
if lid != link._fullname]
if not weighted[k]:
del weighted[k]
set_live_promotions((links, weighted))
promotion_log(link, "dequeued")
emailer.reject_promo(link, reason = reason)
示例6: reject_promotion
def reject_promotion(link, reason=None):
# update the query queue
# Since status is updated first,
# if make_daily_promotions happens to run
# while we're doing work here, it will correctly exclude it
set_promote_status(link, PROMOTE_STATUS.rejected)
all_ads = get_live_promotions([LiveAdWeights.ALL_ADS])
links = set(x.link for x in all_ads[LiveAdWeights.ALL_ADS])
if link._fullname in links:
PromotionLog.add(link, 'has live campaigns, terminating')
queue_changed_promo(link, "rejected")
# Send a rejection email (unless the advertiser requested the reject)
if not c.user or c.user._id != link.author_id:
emailer.reject_promo(link, reason=reason)
hooks.get_hook('promotion.void').call(link=link)
示例7: reject_promotion
def reject_promotion(link, reason = None):
promotion_log(link, "status update: rejected")
# update the query queue
set_status(link, STATUS.rejected)
# check to see if this link is a member of the current live list
links, weighted = get_live_promotions()
if link._fullname in links:
links.remove(link._fullname)
for k in list(weighted.keys()):
weighted[k] = [(lid, w, cid) for lid, w, cid in weighted[k]
if lid != link._fullname]
if not weighted[k]:
del weighted[k]
set_live_promotions((links, weighted))
promotion_log(link, "dequeued")
# don't send a rejection email when the rejection was user initiated.
if not c.user or c.user._id != link.author_id:
emailer.reject_promo(link, reason = reason)