当前位置: 首页>>代码示例>>Python>>正文


Python RedisPool.delete方法代码示例

本文整理汇总了Python中point.util.redispool.RedisPool.delete方法的典型用法代码示例。如果您正苦于以下问题:Python RedisPool.delete方法的具体用法?Python RedisPool.delete怎么用?Python RedisPool.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在point.util.redispool.RedisPool的用法示例。


在下文中一共展示了RedisPool.delete方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: reg_invite_set_login

# 需要导入模块: from point.util.redispool import RedisPool [as 别名]
# 或者: from point.util.redispool.RedisPool import delete [as 别名]
def reg_invite_set_login(value):
    sess = env.user.session()
    if not sess.data():
        env.user.session(reg_invite_set_login, key=value)
        return 'Please enter your nickname'

    if not sess['key']:
        env.user.session_destroy()
        return 'Fail'


    env.user.session_destroy()

    if value.startswith('@'):
        value = value[1:]
    if not validate_nickname(value):
        return xmpp_template('reg_invalid')

    try:
        users.register(login=value, accounts=[('xmpp', env.jid)])
        redis = RedisPool(settings.storage_socket)
        redis.delete('invite:%s' % sess['key'])
        return xmpp_template('reg_ok', login=value)
    except UserExists:
        return 'User @%s already exists.' % value

    except UserError, e:
        log.error('%s: %s' % (e.__class__.__name__, e.message))
        return e.message
开发者ID:radjah,项目名称:point-xmpp,代码行数:31,代码来源:users.py

示例2: login_key

# 需要导入模块: from point.util.redispool import RedisPool [as 别名]
# 或者: from point.util.redispool.RedisPool import delete [as 别名]
def login_key(key):
    if env.user.id:
        env.user.logout()

    redis = RedisPool(settings.storage_socket)
    try:
        user_id = int(redis.get("login:%s" % key))
    except (TypeError, ValueError):
        raise NotFound
    redis.delete("login:%s" % key)

    env.user = WebUser(user_id)
    env.user.authenticate()

    return Response(redirect="%s://%s/" % (env.request.protocol, settings.domain))
开发者ID:artss,项目名称:point-www-new,代码行数:17,代码来源:auth.py

示例3: reset_password

# 需要导入模块: from point.util.redispool import RedisPool [as 别名]
# 或者: from point.util.redispool.RedisPool import delete [as 别名]
def reset_password(code, password):
    redis = RedisPool(settings.storage_socket)
    key = 'reset-password:%s' % code
    print key
    id = redis.get(key)
    if not id:
        raise UserNotFound
    try:
        user = User(int(id))
    except ValueError:
        raise UserNotFound
    user.set_password(password)
    user.save()
    redis.delete(key)
    return user
开发者ID:postman0,项目名称:point-core,代码行数:17,代码来源:users.py

示例4: delete

# 需要导入模块: from point.util.redispool import RedisPool [as 别名]
# 或者: from point.util.redispool.RedisPool import delete [as 别名]
    def delete(self):
        files = []
        for ff in db.fetchall("SELECT files FROM posts.comments "
                              "WHERE post_id=%s;", [unb26(self.id)]):
            if ff and ff['files']:
                files.extend(ff['files'])
        for ff in db.fetchone("DELETE FROM posts.posts WHERE id=%s "
                              "RETURNING files;", [unb26(self.id)]):
            if ff:
                files.extend(ff)

        redis = RedisPool(settings.storage_socket)
        redis.delete('cmnt_cnt.%s' % unb26(self.id))

        for f in files:
            remove_attach(f)
开发者ID:artss,项目名称:point-core,代码行数:18,代码来源:post.py

示例5: delete

# 需要导入模块: from point.util.redispool import RedisPool [as 别名]
# 或者: from point.util.redispool.RedisPool import delete [as 别名]
    def delete(self):
        files = []
        for ff in db.fetchall("SELECT files FROM posts.comments " "WHERE post_id=%s;", [unb26(self.id)]):
            if ff and ff["files"]:
                files.extend(ff["files"])
        for ff in db.fetchone("DELETE FROM posts.posts WHERE id=%s " "RETURNING files;", [unb26(self.id)]):
            if ff:
                files.extend(ff)

        redis = RedisPool(settings.storage_socket)
        redis.delete("cmnt_cnt.%s" % unb26(self.id))

        for f in files:
            remove_attach(f)

        es = elasticsearch.Elasticsearch()
        try:
            es.delete(index="point-posts", doc_type="post", id=self.id)
        except elasticsearch.exceptions.NotFoundError:
            pass
开发者ID:ap-Codkelden,项目名称:point-core,代码行数:22,代码来源:post.py

示例6: update_feed

# 需要导入模块: from point.util.redispool import RedisPool [as 别名]
# 或者: from point.util.redispool.RedisPool import delete [as 别名]
    def update_feed(self, id):
        try:
            feed = Feed(id)
        except FeedNotFound:
            log.error('Feed #%s does not exist. Skipped.' % id)
            return

        redis = RedisPool(settings.storage_socket)

        try:
            feed.fetch()

            redis.delete('feed:retries:%s' % feed.id)

            for p in feed.posts():
                if not p.id:
                    if p.tags:
                        p.tags.insert(0, 'news')
                    else:
                        p.tags = ['news']
                    add_post(p)

            log.info('Feed #%s: %s new entries saved' % \
                     (feed.id, len(feed.posts())))

            feed.update_task()

        except FeedFetchError:
            retries = redis.incr('feed:retries:%s' % feed.id)
            log.error('Feed #%s: %s retries failed' % (feed.id, retries))
            if retries > settings.feed_retries:
                redis.delete('feed:retries:%s' % feed.id)
                return
            timeout = settings.feed_retry_timeout * retries
            feed.update_at(datetime.now() + timedelta(seconds=timeout))

        except InvalidFeedType:
            redis.delete('feed:retries:%s' % feed.id)
            feed.update_at(datetime.now() + \
                           timedelta(seconds=settings.feed_max_update_timeout))
开发者ID:ap-Codkelden,项目名称:point-feed,代码行数:42,代码来源:worker.py

示例7: cache_del

# 需要导入模块: from point.util.redispool import RedisPool [as 别名]
# 或者: from point.util.redispool.RedisPool import delete [as 别名]
def cache_del(key):
    log.debug("cache_del %s" % key)
    redis = RedisPool(settings.cache_socket)
    redis.delete(key)
开发者ID:isqua-test,项目名称:point-core,代码行数:6,代码来源:__init__.py


注:本文中的point.util.redispool.RedisPool.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。