当前位置: 首页>>代码示例>>Python>>正文


Python IAnnotations.has_key方法代码示例

本文整理汇总了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
开发者ID:kroman0,项目名称:products,代码行数:28,代码来源:exportimport.py

示例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
开发者ID:collective,项目名称:getpaid.virtualmerchant,代码行数:14,代码来源:virtualmerchant.py

示例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]
开发者ID:socialplanning,项目名称:opencore,代码行数:6,代码来源:utils.py

示例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]
开发者ID:a25kk,项目名称:stv2,代码行数:8,代码来源:categorymapper.py


注:本文中的zope.app.annotation.interfaces.IAnnotations.has_key方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。