本文整理汇总了Python中zope.app.annotation.interfaces.IAnnotations.has_key方法的典型用法代码示例。如果您正苦于以下问题:Python IAnnotations.has_key方法的具体用法?Python IAnnotations.has_key怎么用?Python IAnnotations.has_key使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zope.app.annotation.interfaces.IAnnotations
的用法示例。
在下文中一共展示了IAnnotations.has_key方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: registerPersistentConfig
# 需要导入模块: from zope.app.annotation.interfaces import IAnnotations [as 别名]
# 或者: from zope.app.annotation.interfaces.IAnnotations import has_key [as 别名]
def registerPersistentConfig(site, type_):
""" Try to get persistent pipeline configuration of given type (export or import)
and register it for use with transmogrifier.
"""
global CONFIGFILE
anno = IAnnotations(site)
key = '%s.%s' % (ANNOKEY, type_)
config = anno.has_key(key) and anno[key] or None
# unregister old config
name = 'persitent-%s' % type_
if name in configuration_registry._config_ids:
configuration_registry._config_ids.remove(name)
del configuration_registry._config_info[name]
# register new
if config is not None:
title = description = u'Persistent %s pipeline'
tf = tempfile.NamedTemporaryFile('w+t', suffix='.cfg')
tf.write(config)
tf.seek(0)
CONFIGFILE = tf
configuration_registry.registerConfiguration(name, title, description, tf.name)
return name
else:
return None
示例2: capture
# 需要导入模块: from zope.app.annotation.interfaces import IAnnotations [as 别名]
# 或者: from zope.app.annotation.interfaces.IAnnotations import has_key [as 别名]
def capture(self, order, amount):
annotations = IAnnotations(order)
trans_id = annotations[interfaces.keys.processor_txn_id]
if annotations.has_key(APPROVAL_KEY):
annotation = IAnnotations( order )
if annotation.get( interfaces.keys.capture_amount ) is None:
annotation[ interfaces.keys.capture_amount ] = amount
else:
annotation[ interfaces.keys.capture_amount ] += amount
return interfaces.keys.results_success
return result.response_reason
示例3: clear_view_memo
# 需要导入模块: from zope.app.annotation.interfaces import IAnnotations [as 别名]
# 或者: from zope.app.annotation.interfaces.IAnnotations import has_key [as 别名]
def clear_view_memo(request):
anot = IAnnotations(request)
if anot.has_key(view.ViewMemo.key):
del anot[view.ViewMemo.key]
示例4: __init__
# 需要导入模块: from zope.app.annotation.interfaces import IAnnotations [as 别名]
# 或者: from zope.app.annotation.interfaces.IAnnotations import has_key [as 别名]
def __init__(self, context):
self.context = context
annotations = IAnnotations(context)
if not annotations.has_key(CATEGORY_ANNOTATIONS_KEY):
annotations[CATEGORY_ANNOTATIONS_KEY] = PersistentMapping()
self.storage = annotations[CATEGORY_ANNOTATIONS_KEY]