本文整理匯總了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]