PromoteController: Use _byID36 with id36

This commit is contained in:
Keith Mitchell
2013-01-02 16:31:52 -08:00
committed by Neil Williams
parent 3c2356c1a5
commit 7a1bc4eef1

View File

@@ -401,17 +401,18 @@ class PromoteController(ListingController):
else:
min_daily_bid = g.min_promote_bid
# you cannot edit the bid of a live ad unless it's a freebie
try:
campaign = PromoCampaign._byID(campaign_id36)
if (bid != campaign.bid and
campaign.start_date < datetime.now(g.tz)
and not campaign.is_freebie()):
c.errors.add(errors.BID_LIVE, field='bid')
form.has_errors('bid', errors.BID_LIVE)
return
except NotFound:
pass
if campaign_id36:
# you cannot edit the bid of a live ad unless it's a freebie
try:
campaign = PromoCampaign._byID36(campaign_id36)
if (bid != campaign.bid and
campaign.start_date < datetime.now(g.tz)
and not campaign.is_freebie()):
c.errors.add(errors.BID_LIVE, field='bid')
form.has_errors('bid', errors.BID_LIVE)
return
except NotFound:
pass
if bid is None or bid / duration < min_daily_bid:
c.errors.add(errors.BAD_BID, field = 'bid',