Exemple #1
0
def pool_info(pool_id):
    ret = util.get_nav(session) + globals.get_message(request.args.get('m'))
    pool = util.get_pool_info(pool_id)
    if pool == None:
        ret = ret + "Pool not found"
    else:
        ret = ret + ("<h1>Pool ID: %s</h1>" % pool_id) + util.txt(
            "pool_box", **pool)
    return util.txt('frame', title='Pool info', style='', script='', body=ret)
Exemple #2
0
def pool_create():
    if 'username' not in session:
        return redirect("/login/?error=l")
    return util.txt('frame',
                    title='Create pool',
                    style='',
                    script='',
                    body=util.get_nav(session) +
                    globals.get_message(request.args.get('m')) + '<br/>' +
                    util.txt('pool_create_form'))
Exemple #3
0
def run():
  no_context = [ '/r/nocontext' ]
  banned_subreddits = [ 'wishlist', 'cringepics', 'askreddit' ]
  r = login.init()
  my_id = login.my_id(r)
  while True:
    try:
      for comment in praw.helpers.comment_stream(r, 'all', verbosity=0):
        subreddit = comment.subreddit.display_name.lower()
        if subreddit in banned_subreddits:
          continue
        text = util.txt(comment).lower().strip()
        if text in no_context \
            and not comment.is_root \
            and not db.has_replied(comment.id):
          db.reply(comment.id)
          login.refresh_praw(r)
          reply(r, comment)
    except praw.errors.OAuthInvalidToken:
      login.refresh_praw(r)