def GET_current_promos(self): render_list = list(wrap_links(get_promoted())) for x in render_list: if x.promote_until: x.promote_expires = timetext(datetime.now(g.tz) - x.promote_until) page = PromotePage('current_promos', content = PromotedLinks(render_list)) return page.render()
def GET_edit_promo(self, link): if link.promoted is None: return self.abort404() rendered = wrap_links(link) timedeltatext = '' if link.promote_until: timedeltatext = timetext(link.promote_until - datetime.now(g.tz), resultion=2) form = PromoteLinkForm(link = link, listing = rendered, timedeltatext = timedeltatext) page = PromotePage('new_promo', content = form) return page.render()
def GET_current_promos(self): current_list = get_promoted() b = IDBuilder(current_list) render_list = b.get_items()[0] for x in render_list: if x.promote_until: x.promote_expires = timetext(datetime.now(g.tz) - x.promote_until) page = PromotePage('current_promos', content = PromotedLinks(render_list)) return page.render()
def GET_edit_promo(self, link): sr = Subreddit._byID(link.sr_id) listing = wrap_links(link) timedeltatext = '' if link.promote_until: timedeltatext = timetext(link.promote_until - datetime.now(g.tz), resultion=2) form = PromoteLinkForm(sr = sr, link = link, listing = listing, timedeltatext = timedeltatext) page = PromotePage('new_promo', content = form) return page.render()
def GET_edit_promo(self, link): sr = Subreddit._byID(link.sr_id) names = [link._fullname] builder = IDBuilder(names, wrap = ListingController.builder_wrapper) listing = LinkListing(builder, show_nums = False, nextprev = False) rendered = listing.listing().render() timedeltatext = '' if link.promote_until: timedeltatext = timetext(link.promote_until - datetime.now(g.tz), resultion=2) form = PromoteLinkForm(sr = sr, link = link, listing = rendered, timedeltatext = timedeltatext) page = PromotePage('new_promo', content = form) return page.render()