From 7a1bc4eef17a1a29e0d794657107a7a74ae731bb Mon Sep 17 00:00:00 2001 From: Keith Mitchell Date: Wed, 2 Jan 2013 16:31:52 -0800 Subject: [PATCH] PromoteController: Use _byID36 with id36 --- r2/r2/controllers/promotecontroller.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/r2/r2/controllers/promotecontroller.py b/r2/r2/controllers/promotecontroller.py index 7cbac6a8b..eb08882a5 100644 --- a/r2/r2/controllers/promotecontroller.py +++ b/r2/r2/controllers/promotecontroller.py @@ -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',