當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。