Make advertisers and sponsors have same start date restrictions.

This commit is contained in:
Brian Simpson
2014-02-06 16:12:09 -05:00
parent 1f87b93e7f
commit a3153d61dd

View File

@@ -565,7 +565,7 @@ class PromoteController(ListingController):
@validatedForm(VSponsor('link_id36'),
VModhash(),
dates=VDateRange(['startdate', 'enddate'],
earliest=timedelta(days=1),
earliest=timedelta(days=g.min_promote_future),
latest=timedelta(days=g.max_promote_future),
reference_date=promote.promo_datetime_now,
business_days=True,
@@ -590,21 +590,6 @@ class PromoteController(ListingController):
if location:
cpm += g.cpm_selfserve_geotarget.pennies
if (start and end and not promote.is_accepted(link) and
not c.user_is_sponsor):
# if the ad is not approved already, ensure the start date
# is at least 2 days in the future
start = start.date()
end = end.date()
now = promote.promo_datetime_now()
future = make_offset_date(now, g.min_promote_future,
business_days=True)
if start < future.date():
day = promote.promo_datetime_now(offset=g.min_promote_future)
day = day.strftime("%m/%d/%Y")
c.errors.add(errors.DATE_TOO_EARLY, msg_params=dict(day=day),
field="startdate")
if (form.has_errors('startdate', errors.BAD_DATE,
errors.DATE_TOO_EARLY, errors.DATE_TOO_LATE) or
form.has_errors('enddate', errors.BAD_DATE, errors.DATE_TOO_EARLY,