本文整理汇总了Python中ZODB.PersistentMapping.PersistentMapping.clear方法的典型用法代码示例。如果您正苦于以下问题:Python PersistentMapping.clear方法的具体用法?Python PersistentMapping.clear怎么用?Python PersistentMapping.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZODB.PersistentMapping.PersistentMapping
的用法示例。
在下文中一共展示了PersistentMapping.clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: csvreplicataTool
# 需要导入模块: from ZODB.PersistentMapping import PersistentMapping [as 别名]
# 或者: from ZODB.PersistentMapping.PersistentMapping import clear [as 别名]
#.........这里部分代码省略.........
self.setExcludedfields(REQUEST.get('excludedfields').split('\n'));
# Redirection of the page now that the treatment is done
REQUEST.RESPONSE.redirect(self.absolute_url()+'/csv_settings')
def getPortalTypeNames(self):
"""
"""
l = getPortalTypes(self).keys()
l.sort()
return [(k, k) for k in l]
def getReplicableTypesSorted(self):
"""
"""
l = self.replicabletypes.keys()
l.sort()
return l
def getTypeSchematas(self, type):
"""
"""
attool = getToolByName(self, 'archetype_tool')
pt = getPortalTypes(self)
if pt.has_key(type):
(package, name) = pt[type]
t = attool.lookupType(package, name)
return t['klass'].schema.getSchemataNames()
else:
return []
def setCSVHandledTypesSchematas(self, REQUEST):
"""
"""
currentreplicablestypes = self.replicabletypes
i = 0
for ptn in self.getReplicableTypesSorted():
i += 1
if (type(ptn) is tuple):
t = ptn[0]
else:
t = ptn
r = REQUEST.get('csvhandledschematas-'+str(i))
if r:
if (not type(r) is list):
r = [r]
currentreplicablestypes[t] = r
else :
if currentreplicablestypes.has_key(t):
del currentreplicablestypes[t]
self.replicabletypes.update(currentreplicablestypes)
# Redirection of the page now that the treatment is done
REQUEST.RESPONSE.redirect(self.absolute_url()+'/csv_settings')
def clearReplicableTypes(self):
"""
"""
self.replicabletypes.clear()
def printReplicableTypes(self):
"""
"""
return self.replicabletypes
def getHandlers(self):
"""
"""
if not getattr(self, 'handlers', None):
setattr(self, 'handlers', {})
# migrate persistent mapping with possible new values
for h in HANDLERS:
if not h in self.handlers:
self.handlers[h] = HANDLERS[h]
return self.handlers
def setHandler(self, key, value):
"""
"""
self.handlers[key] = value
def delHandler(self, key):
"""
"""
del(self.handlers[key])
def getNonExportableFields(self):
return (self.getExcludedfields()
+ ('tableContents',))
def fullactivation(self):
types = getPortalTypes(self)
self.replicabletypes.update(
dict(
[(t, self.getTypeSchematas(t))
for t in types])
)