コード例 #1
0
ファイル: about.py プロジェクト: rram/reddit-plugin-about
 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()
コード例 #2
0
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)
コード例 #3
0
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)
コード例 #4
0
 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()
コード例 #5
0
ファイル: about.py プロジェクト: xilvar/reddit-plugin-about
 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()
コード例 #6
0
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
コード例 #7
0
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
コード例 #8
0
def health_check():
    """Calculate the number of seconds since promotions were last updated"""
    return time.time() - int(NamedGlobals.get(PROMO_HEALTH_KEY, default=0))
コード例 #9
0
ファイル: trending.py プロジェクト: znanl/reddit
def get_trending_subreddits():
    return NamedGlobals.get(TRENDING_SUBREDDITS_KEY, None)
コード例 #10
0
ファイル: promote.py プロジェクト: AD42/reddit
def health_check():
    """Calculate the number of seconds since promotions were last updated"""
    return time.time() - int(NamedGlobals.get(PROMO_HEALTH_KEY, default=0))
コード例 #11
0
ファイル: trending.py プロジェクト: 0xcd03/reddit
def get_trending_subreddits():
    return NamedGlobals.get(TRENDING_SUBREDDITS_KEY, None)
コード例 #12
0
ファイル: promote.py プロジェクト: chrisrote/reddit
def health_check():
    return NamedGlobals.get(PROMO_HEALTH_KEY, default=0)