當前位置: 首頁>>代碼示例>>Python>>正文


Python PersistentMapping.clear方法代碼示例

本文整理匯總了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])
        )
開發者ID:tuxwerk,項目名稱:Products.csvreplicata,代碼行數:104,代碼來源:csvreplicataTool.py


注:本文中的ZODB.PersistentMapping.PersistentMapping.clear方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。