def GET_index(self): quote = self._get_quote() images = self._get_images() stats = NamedGlobals.get("about_reddit_stats", None) content = About( quote=quote, images=images, stats=stats, events=g.plugins["about"].timeline_data, sites=g.plugins["about"].sites_data, ) return AboutPage("about-main", _("we power awesome communities."), _("about reddit"), content).render()
def get_current_press(): key = _CURRENT_PRESS_KEY() val = g.thebuttoncache.get(key) if val is None: try: val = NamedGlobals.get(key) except NotFoundException: val = NONE g.thebuttoncache.set(key, val) if val == NONE: return None elif val: return _deserialize_datetime(val)
def GET_index(self): quote = self._get_quote() images = self._get_images() stats = NamedGlobals.get('about_reddit_stats', None) c.js_preload.set('#images', images) content = About( quote=quote, images=images, stats=stats, events=g.plugins['about'].timeline_data, sites=g.plugins['about'].sites_data, ) return AboutPage( content_id='about-main', title_msg=_('we power awesome communities.'), pagename=_('about reddit'), content=content, ).render()
def has_timer_expired(): # note: this only checks if the timer has been marked as expired, it doesn't # actually check its value (that's done in check_timer) key = _EXPIRED_KEY() val = g.thebuttoncache.get(key) if val is None: try: val = NamedGlobals.get(key) except NotFoundException: # has never been set, set the key val = False NamedGlobals.set(key, val) # update the cache g.thebuttoncache.set(key, val) if val: return _deserialize_datetime(val) return val
def health_check(): """Calculate the number of seconds since promotions were last updated""" return time.time() - int(NamedGlobals.get(PROMO_HEALTH_KEY, default=0))
def get_trending_subreddits(): return NamedGlobals.get(TRENDING_SUBREDDITS_KEY, None)
def health_check(): return NamedGlobals.get(PROMO_HEALTH_KEY, default=0)