promote.py: Delete unneeded wrap_promoted and sponsor_wrapper.

This commit is contained in:
Brian Simpson
2013-11-08 08:12:58 -05:00
parent 10338889f5
commit 24324b642a
3 changed files with 4 additions and 16 deletions

View File

@@ -272,7 +272,7 @@ class PromoteController(ListingController):
def GET_edit_promo(self, link):
if not link or link.promoted is None:
return self.abort404()
rendered = wrap_links(link, wrapper=promote.sponsor_wrapper, skip=False)
rendered = wrap_links(link, skip=False)
form = PromoteLinkForm(link, rendered)
page = PromotePage('new_promo', content=form)
return page.render()

View File

@@ -3563,7 +3563,7 @@ class PromoteLinkForm(Templated):
self.subreddit_selector = SubredditSelector()
self.link = promote.wrap_promoted(link)
self.link = link
self.listing = listing
campaigns = PromoCampaign._by_link(link._id)
self.campaigns = promote.get_renderable_campaigns(link, campaigns)
@@ -3598,8 +3598,7 @@ class RefundPage(Reddit):
def __init__(self, link, campaign):
self.link = link
self.campaign = campaign
self.listing = wrap_links(link, wrapper=promote.sponsor_wrapper,
skip=False)
self.listing = wrap_links(link, skip=False)
billable_impressions = promote.get_billable_impressions(campaign)
billable_amount = promote.get_billable_amount(campaign,
billable_impressions)
@@ -3783,7 +3782,7 @@ class MediaEmbedBody(CachedTemplate):
class PaymentForm(Templated):
def __init__(self, link, campaign, **kw):
self.link = promote.wrap_promoted(link)
self.link = link
self.campaign = promote.get_renderable_campaigns(link, campaign)
Templated.__init__(self, **kw)

View File

@@ -30,7 +30,6 @@ import time
from pylons import g, c
from pylons.i18n import ungettext
from r2.lib.wrapped import Wrapped
from r2.lib import (
amqp,
authorize,
@@ -235,10 +234,6 @@ def get_renderable_campaigns(link, campaigns):
r = r[0]
return r
def wrap_promoted(link):
if not isinstance(link, Wrapped):
link = Wrapped(link)
return link
# These could be done with relationships, but that seeks overkill as
# we never query based on user and only check per-thing
@@ -307,12 +302,6 @@ def new_promotion(title, url, selftext, user, ip):
emailer.new_promo(l)
return l
def sponsor_wrapper(link):
w = Wrapped(link)
w.render_class = PromotedLink
w.rowstyle = "promoted link"
return w
def get_transactions(link, campaigns):
"""Return Bids for specified campaigns on the link.