本文整理汇总了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}))
示例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)
示例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)
示例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')