Move onchange out of set_promote_status.

This commit is contained in:
bsimpson63
2012-10-24 15:25:18 -04:00
parent 7ba1d9dde5
commit bbe091c599
2 changed files with 7 additions and 9 deletions

View File

@@ -668,7 +668,7 @@ def get_user_reported(user_id):
get_user_reported_messages(user_id)]
def set_promote_status(link, promote_status, onchange=None):
def set_promote_status(link, promote_status):
from r2.lib.promote import STATUS
all_queries = [promote_query(link.author_id) for promote_query in
(get_unpaid_links, get_unapproved_links,
@@ -698,8 +698,6 @@ def set_promote_status(link, promote_status, onchange=None):
link.promote_status = promote_status
link._commit()
if onchange:
onchange()
def _promoted_link_query(user_id, status):

View File

@@ -566,8 +566,8 @@ def charge_pending(offset=1):
if is_promoted(l):
emailer.queue_promo(l, camp.bid, camp.trans_id)
else:
set_promote_status(l, STATUS.pending,
onchange=lambda: emailer.queue_promo(l, camp.bid, camp.trans_id))
set_promote_status(l, STATUS.pending)
emailer.queue_promo(l, camp.bid, camp.trans_id)
text = ('auth charge for campaign %s, trans_id: %d' %
(camp._id, camp.trans_id))
PromotionLog.add(l, text)
@@ -728,8 +728,8 @@ def make_daily_promotions(offset = 0, test = False):
print "unpromote", l
else:
# update the query queue
set_promote_status(links[l], STATUS.finished,
onchange = lambda: emailer.finished_promo(links[l]))
set_promote_status(links[l], STATUS.finished)
emailer.finished_promo(links[l])
for l in new_links:
if is_accepted(links[l]):
@@ -737,8 +737,8 @@ def make_daily_promotions(offset = 0, test = False):
print "promote2", l
else:
# update the query queue
set_promote_status(links[l], STATUS.promoted,
onchange = lambda: emailer.live_promo(links[l]))
set_promote_status(links[l], STATUS.promoted)
emailer.live_promo(links[l])
# convert the weighted dict to use sr_ids which are more useful
srs = {"":""}