本文整理汇总了Python中BTrees.IIBTree.IISet.remove方法的典型用法代码示例。如果您正苦于以下问题:Python IISet.remove方法的具体用法?Python IISet.remove怎么用?Python IISet.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BTrees.IIBTree.IISet
的用法示例。
在下文中一共展示了IISet.remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FilteredSetBase
# 需要导入模块: from BTrees.IIBTree import IISet [as 别名]
# 或者: from BTrees.IIBTree.IISet import remove [as 别名]
class FilteredSetBase(Persistent):
def __init__(self, id, expr):
self.id = id
self.expr = expr
self.clear()
def clear(self):
self.ids = IISet()
def index_object(self, documentId, obj):
raise RuntimeError,'index_object not defined'
def unindex_object(self,documentId):
try: self.ids.remove(Id)
except: pass
def getId(self): return self.id
def getExpression(self): return self.expr
def getIds(self): return self.ids
def getType(self): return self.meta_type
def setExpression(self, expr): self.expr = expr
def __repr__(self):
return '%s: (%s) %s' % (self.id,self.expr,map(None,self.ids))
__str__ = __repr__
示例2: ZchSite
# 需要导入模块: from BTrees.IIBTree import IISet [as 别名]
# 或者: from BTrees.IIBTree.IISet import remove [as 别名]
#.........这里部分代码省略.........
raise KeyError, id
# make sure it's in our list of children
if not self.ids.has_key(id):
raise KeyError, id
# return the posting
return self.data[id].__of__(self)
security.declareProtected(View, 'zchcrypt')
def zchcrypt(self,word,key):
import hmac, base64
h = hmac.new(key)
h.update(word)
return base64.encodestring(h.digest())[:-3]
security.declareProtected(View, 'zchfqdn')
def zchfqdn(self,n):
return getfqdn(n)
security.declarePrivate('delItem')
def delItem(self,id):
if not self.data.has_key(id):
return
if self.ids.has_key(id): # article
article = self.data[id].__of__(self)
for comment_id in article.ids:
obj = self.data[comment_id].__of__(article)
self.uncatalog_object(obj.getPhysicalPath())
del self.data[comment_id]
self.uncatalog_object(article.getPhysicalPath())
del self.data[id]
self.ids.remove(id)
else: # comment
parent = self.data[self.data[id].parent_id].__of__(self)
# remove it from it's parents list of ids
obj = self.data[id].__of__(parent)
self.uncatalog_object(obj.getPhysicalPath())
del self.data[id]
parent.ids.remove(id)
security.declarePrivate('createId')
def createId(self):
id=int(time())
while self.data.has_key(id):
id=id+1
return id
security.declarePrivate('data_map')
def data_map(self,ids):
result=[]
for id in ids:
result.append(self.data[id].__of__(self))
return result
security.declareProtected(View, 'article_list')
def article_list(self, size=None):
""" returns article items """
def cmp_by_modified(x, y):
return cmp(y.modified, x.modified)
items = self.data_map(self.ids)
items.sort(cmp_by_modified)
if size:
items = items[:size]
for i in range(len(items)):