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)
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)
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)
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)
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)
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)
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) 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, '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)
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)
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)
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)