def __init__(self, sorts, team, alumni): Templated.__init__(self, sorts=sorts, team=team, alumni=alumni) sort_buttons = [ OffsiteButton(sort["title"], "#sort/" + sort["id"], css_class="choice-" + sort["id"]) for sort in sorts.values() ] self.sort_menu = NavMenu( sort_buttons, title=_("sorted by"), base_path=request.path, type="lightdrop", default="#sort/random" )
def __init__(self, *args, **kwargs): nav_buttons = [ NavButton(_("overview"), "/advertising"), OffsiteButton( _("getting started"), "https://reddit.zendesk.com/hc/en-us/articles/205118995-Step-by-step-How-to-create-an-ad", ), OffsiteButton( _("audience"), "https://reddit.zendesk.com/hc/en-us/articles/205183225-Audience-and-Demographics" ), OffsiteButton( _("best practices"), "https://reddit.zendesk.com/hc/en-us/sections/200863319-Best-Practices-Tips" ), OffsiteButton(_("help center"), "https://reddit.zendesk.com/hc/en-us/categories/200352595-Advertising-"), NavButton( _("manage ads"), "/promoted?utm_source=advertising&utm_medium=button&utm_term=manage%20ads&utm_campaign=buttons", ), ] self.create_ad_url = ( "/promoted/new_promo?utm_source=advertising&utm_medium=button&utm_term=create%20ads&utm_campaign=buttons" ) self.nav_menu = NavMenu( nav_buttons, type="flatlist", base_path="", css_class="advertising-menu", separator=None ).render() sections = SelfServeContent.get_all(return_dict=True) self.banner = sections.get("banner") self.info = sections.get("info") self.advertisers = sections.get("advertisers") self.subreddit = sections.get("subreddit") self.help = sections.get("help") blurbs = SelfServeBlurb.get_all(return_dict=True) if "platform" in blurbs: min_cpm = min( [g.cpm_selfserve_collection.decimal, g.cpm_selfserve.decimal, g.cpm_selfserve_geotarget_metro.decimal] ) formatted_min_cpm = format_currency(min_cpm, "USD", locale=c.locale) formatted_min_bid = format_currency(g.min_promote_bid, "USD", locale=c.locale) blurbs["platform"].text = ( blurbs["platform"] .text.replace("[min_promote_bid]", formatted_min_bid) .replace("[cpm_selfserve]", formatted_min_cpm) ) self.blurbs = blurbs.values() self.advertiser_logos = SelfServeAdvertiser.get_all() self.quotes = SelfServeQuote.get_all() self.help_text = None try: self.help_text = WikiPage.get(Frontpage, g.wiki_page_selfserve_help).content except NotFound: pass Templated.__init__(self, *args, **kwargs)
def __init__(self, meetup, connections): self.meetup = meetup self.connections = [] for account in connections: wrapped = WrappedUser(account) wrapped.is_friend = account._id in c.user.friends self.connections.append(wrapped) self.my_fullname = c.user._fullname Templated.__init__(self)
def __init__(self, meetup, user): self.meetup = meetup self.topics = [] for topic, generator in TOPICS.iteritems(): self.topics.append({ "code": topic, "title": generator.title(), "content": generator(user), }) Templated.__init__(self)
def __init__(self, team, alumni, sorts, extra_sorts): Templated.__init__(self, team=team, alumni=alumni, sorts=sorts + extra_sorts) sort_buttons = [] extra_sort_index = random.randint(len(sorts), len(self.sorts)-1) for idx, sort in enumerate(self.sorts): css_class = 'choice-'+sort['id'] if sort in extra_sorts and idx != extra_sort_index: css_class += ' hidden-sort' button = OffsiteButton(sort['title'], '#sort/'+sort['id'], css_class=css_class) sort_buttons.append(button) self.sort_menu = NavMenu(sort_buttons, title=_('sorted by'), base_path=request.path, type='lightdrop', default='#sort/random') # The caching check won't catch the hidden-sort classes self.sort_menu.cachable = False
def __init__(self, meetup): self.meetup = meetup self.date = meetup.date.date() self.date_text = format_date(self.date, "long", locale=c.locale) self.find_meetup_url = self.date.strftime("http://redditgifts.com/" "meetups/%m/%d/%Y") self.show_finder = meetup.state in ("prep", "active") self.show_badge = meetup.state in ("prep", "active") self.show_connect = meetup.state in ("active", "after") self.show_connections = meetup.state in ("after", "closed") Templated.__init__(self)
def __init__(self, sorts, team, alumni): Templated.__init__(self, sorts=sorts, team=team, alumni=alumni) sort_buttons = [ OffsiteButton( sort["title"], "#sort/" + sort["id"], css_class="choice-" + sort["id"], ) for sort in sorts.values()] self.sort_menu = NavMenu( sort_buttons, title=_("sorted by"), base_path=request.path, type="lightdrop", default="#sort/random", )
def __init__(self, *args, **kwargs): nav_buttons = [ NavButton(_('overview'), '/advertising'), OffsiteButton(_('getting started'), 'https://reddit.zendesk.com/hc/en-us/articles/205118995-Step-by-step-How-to-create-an-ad'), OffsiteButton(_('audience'), 'https://reddit.zendesk.com/hc/en-us/articles/205183225-Audience-and-Demographics'), OffsiteButton(_('best practices'), 'https://reddit.zendesk.com/hc/en-us/sections/200863319-Best-Practices-Tips'), OffsiteButton(_('help center'), 'https://reddit.zendesk.com/hc/en-us/categories/200352595-Advertising-'), NavButton(_('manage ads'), '/promoted?utm_source=advertising&utm_medium=button&utm_term=manage%20ads&utm_campaign=buttons'), ] self.create_ad_url = '/promoted/new_promo?utm_source=advertising&utm_medium=button&utm_term=create%20ads&utm_campaign=buttons' self.nav_menu = NavMenu(nav_buttons, type='flatlist', base_path='', css_class='advertising-menu', separator=None).render() sections = SelfServeContent.get_all(return_dict=True) self.banner = sections.get('banner') self.info = sections.get('info') self.advertisers = sections.get('advertisers') self.subreddit = sections.get('subreddit') self.help = sections.get('help') blurbs = SelfServeBlurb.get_all(return_dict=True) if 'platform' in blurbs: min_cpm = min([ g.cpm_selfserve_collection.decimal, g.cpm_selfserve.decimal, g.cpm_selfserve_geotarget_metro.decimal, ]) formatted_min_cpm = format_currency(min_cpm, 'USD', locale=c.locale) formatted_min_budget = format_currency( g.min_total_budget_pennies / 100., 'USD', locale=c.locale) blurbs['platform'].text = blurbs['platform'].text.replace( '[min_promote_bid]', formatted_min_budget).replace( '[cpm_selfserve]', formatted_min_cpm) self.blurbs = blurbs.values() self.advertiser_logos = SelfServeAdvertiser.get_all() self.quotes = SelfServeQuote.get_all() self.help_text = None try: self.help_text = WikiPage.get(Frontpage, g.wiki_page_selfserve_help).content except NotFound: pass Templated.__init__(self, *args, **kwargs)
def __init__(self, *args, **kwargs): nav_buttons = [ NavButton(_('overview'), '/advertising'), NavButton(_('getting started'), '/wiki/selfservenew?utm_source=advertising&utm_medium=button&utm_term=getting%20started&utm_campaign=buttons'), NavButton(_('audience'), '/wiki/mediakit?utm_source=advertising&utm_medium=button&utm_term=audience&utm_campaign=buttons'), NavButton(_('best practices'), '/wiki/brandiquette?utm_source=advertising&utm_medium=button&utm_term=best%20practices&utm_campaign=buttons'), NavButton(_('help center'), '/wiki/selfserve?utm_source=advertising&utm_medium=button&utm_term=help%20center&utm_campaign=buttons'), NavButton(_('manage ads'), '/promoted?utm_source=advertising&utm_medium=button&utm_term=manage%20ads&utm_campaign=buttons'), ] self.create_ad_url = '/promoted/new_promo?utm_source=advertising&utm_medium=button&utm_term=create%20ads&utm_campaign=buttons' self.nav_menu = NavMenu(nav_buttons, type='flatlist', base_path='', css_class='advertising-menu', separator=None).render() sections = SelfServeContent.get_all(return_dict=True) self.banner = sections.get('banner') self.info = sections.get('info') self.advertisers = sections.get('advertisers') self.subreddit = sections.get('subreddit') self.help = sections.get('help') blurbs = SelfServeBlurb.get_all(return_dict=True) if 'platform' in blurbs: min_cpm = min([ g.cpm_selfserve_collection.decimal, g.cpm_selfserve.decimal, g.cpm_selfserve_geotarget_metro.decimal, ]) formatted_min_cpm = format_currency(min_cpm, 'USD', locale=c.locale) formatted_min_bid = format_currency(g.min_promote_bid, 'USD', locale=c.locale) blurbs['platform'].text = blurbs['platform'].text.replace( '[min_promote_bid]', formatted_min_bid).replace( '[cpm_selfserve]', formatted_min_cpm) self.blurbs = blurbs.values() self.advertiser_logos = SelfServeAdvertiser.get_all() self.quotes = SelfServeQuote.get_all() self.help_text = None try: self.help_text = WikiPage.get(Frontpage, g.wiki_page_selfserve_help).content except NotFound: pass Templated.__init__(self, *args, **kwargs)
def __init__(self, *args, **kwargs): nav_buttons = [ NavButton(_('overview'), '/advertising'), OffsiteButton(_('getting started'), 'https://reddit.zendesk.com/hc/en-us/articles/205118995-Step-by-step-How-to-create-an-ad'), OffsiteButton(_('audience'), 'https://reddit.zendesk.com/hc/en-us/articles/205183225-Audience-and-Demographics'), OffsiteButton(_('best practices'), 'https://reddit.zendesk.com/hc/en-us/sections/200863319-Best-Practices-Tips'), OffsiteButton(_('help center'), 'https://reddit.zendesk.com/hc/en-us/categories/200352595-Advertising-'), NavButton(_('manage ads'), '/promoted?utm_source=advertising&utm_medium=button&utm_term=manage%20ads&utm_campaign=buttons'), ] self.create_ad_url = '/promoted/new_promo?utm_source=advertising&utm_medium=button&utm_term=create%20ads&utm_campaign=buttons' self.nav_menu = NavMenu(nav_buttons, type='flatlist', base_path='', css_class='advertising-menu', separator=None).render() sections = SelfServeContent.get_all(return_dict=True) self.banner = sections.get('banner') self.info = sections.get('info') self.advertisers = sections.get('advertisers') self.subreddit = sections.get('subreddit') self.help = sections.get('help') blurbs = SelfServeBlurb.get_all(return_dict=True) if 'platform' in blurbs: min_cpm = min([ g.cpm_selfserve_collection.decimal, g.cpm_selfserve.decimal, g.cpm_selfserve_geotarget_metro.decimal, ]) formatted_min_cpm = format_currency(min_cpm, 'USD', locale=c.locale) formatted_min_bid = format_currency(g.min_promote_bid, 'USD', locale=c.locale) blurbs['platform'].text = blurbs['platform'].text.replace( '[min_promote_bid]', formatted_min_bid).replace( '[cpm_selfserve]', formatted_min_cpm) self.blurbs = blurbs.values() self.advertiser_logos = SelfServeAdvertiser.get_all() self.quotes = SelfServeQuote.get_all() self.help_text = None try: self.help_text = WikiPage.get(Frontpage, g.wiki_page_selfserve_help).content except NotFound: pass Templated.__init__(self, *args, **kwargs)
def __init__(self, meetup, user, topic): self.meetup = meetup self.username = user.name self.link_karma = format_number(max(user.karma("link"), 0)) self.comment_karma = format_number(max(user.karma("comment"), 0)) self.registration_date = format_date(user._date, "medium", c.locale) self.code = "%02d" % utils.make_secret_code(meetup, user) self.url = "%s/or/%s/%s" % (g.shortdomain, user.name, self.code) if not topic: topic = random.choice(TOPICS.keys()) starter = TOPICS[topic] self.starter = Storage( title=starter.title(), content=starter(user), ) Templated.__init__(self)
def __init__(self, *args, **kwargs): nav_buttons = [ NavButton(_('overview'), '/advertising'), NavButton(_('getting started'), '/wiki/selfservenew?utm_source=advertising&utm_medium=button&utm_term=getting%20started&utm_campaign=buttons'), NavButton(_('audience'), '/wiki/mediakit?utm_source=advertising&utm_medium=button&utm_term=audience&utm_campaign=buttons'), NavButton(_('best practices'), '/wiki/selfserve?utm_source=advertising&utm_medium=button&utm_term=best%20practices&utm_campaign=buttons#wiki_what_are_the_best_practices_for_reddit_advertising.3F'), NavButton(_('help center'), '/wiki/selfserve?utm_source=advertising&utm_medium=button&utm_term=help%20center&utm_campaign=buttons'), NavButton(_('manage ads'), '/promoted?utm_source=advertising&utm_medium=button&utm_term=manage%20ads&utm_campaign=buttons'), ] self.create_ad_url = '/promoted/new_promo?utm_source=advertising&utm_medium=button&utm_term=create%20ads&utm_campaign=buttons' self.nav_menu = NavMenu(nav_buttons, type='flatlist', base_path='', css_class='advertising-menu', separator=None).render() sections = SelfServeContent.get_all(return_dict=True) self.banner = sections.get('banner') self.info = sections.get('info') self.advertisers = sections.get('advertisers') self.subreddit = sections.get('subreddit') self.help = sections.get('help') blurbs = SelfServeBlurb.get_all(return_dict=True) if 'platform' in blurbs: formatted_cpm = format_currency(g.cpm_selfserve.decimal, 'USD', locale=c.locale) formatted_min_bid = format_currency(g.min_promote_bid, 'USD', locale=c.locale) blurbs['platform'].text = blurbs['platform'].text.replace( '[min_promote_bid]', formatted_min_bid).replace( '[cpm_selfserve]', formatted_cpm) self.blurbs = blurbs.values() self.advertiser_logos = SelfServeAdvertiser.get_all() self.quotes = SelfServeQuote.get_all() self.help_text = None try: self.help_text = WikiPage.get(Frontpage, g.wiki_page_selfserve_help).content except NotFound: pass Templated.__init__(self, *args, **kwargs)
def __init__(self, listing): self.listing = listing self.scores = scores.get_game_status() Templated.__init__(self)
def __init__(self, target, permalink, author, subreddit): self.text = "%s (%s)" % (target.__class__.__name__, author.name) self.url = permalink self.subreddit = subreddit Templated.__init__(self)
def __init__(self, message): Templated.__init__(self) self.message = message