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


Python Bucket.delete方法代码示例

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


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

示例1: post

# 需要导入模块: from couchbase.bucket import Bucket [as 别名]
# 或者: from couchbase.bucket.Bucket import delete [as 别名]
    def post(self, request, group_id, deck_id):
        c = Bucket('couchbase://localhost/nihongo')
        success = 'dunno'
        print('deleting deck')
        try:
            c.delete(deck_id)
            group = c.get(group_id).value
            print(group.get('decks_list'))
            group.get('decks_list').remove(deck_id)
            c.upsert(group_id, group)
            success = 'success'
        except (BaseException, CouchbaseError) as e:
            success = 'error'
            print(e)

        group = c.get(group_id).value
        group_decks = group.get('decks_list')
        decks_list = []
        for d in group_decks:
            try:
                deck = c.get(d)
                decks_list.append(deck)
            except CouchbaseError:
                pass
        return HttpResponseRedirect(reverse('tutor:group_decks', kwargs={'group_id' : group_id}))
开发者ID:dmitrof,项目名称:nihongo,代码行数:27,代码来源:views.py

示例2: delete_keys

# 需要导入模块: from couchbase.bucket import Bucket [as 别名]
# 或者: from couchbase.bucket.Bucket import delete [as 别名]
def delete_keys(bucket, prefix, low, high):

    client = Bucket(HOST+'/'+bucket)
    deleted = 0
    failed = 0
    for i in xrange(low, high):
        key = prefix +"_"+str(i)
        try:
            client.delete(key)
            deleted = deleted+1 
        except Exception as ex:
            failed = failed+1 
            pass
    print "Deleted " + str(deleted) + " keys.  Missed " + str(failed)
开发者ID:EricACooper,项目名称:sequoia,代码行数:16,代码来源:purger.py

示例3: delete

# 需要导入模块: from couchbase.bucket import Bucket [as 别名]
# 或者: from couchbase.bucket.Bucket import delete [as 别名]
def delete(key, bucket = "default", password = ""):

    cb = Bucket(host=cfg.COUCHBASE_IP + "/" + self.bucket)
    rc = cb.delete(key)
开发者ID:DavidAlphaFox,项目名称:couchbase,代码行数:6,代码来源:sdk_client_tasks.py

示例4: Bucket

# 需要导入模块: from couchbase.bucket import Bucket [as 别名]
# 或者: from couchbase.bucket.Bucket import delete [as 别名]
from couchbase.bucket import Bucket
import sys

mb = Bucket("couchbase:///memoir")

#:print mb.get(sys.argv[1]).value
mb.delete("{\"total_rows\":76,\"rows\":[\r\n]\r\n}\n")
mb.decr('tcount')
开发者ID:shivshankardayal,项目名称:memoir,代码行数:10,代码来源:delete_tag.py


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