Пример #1
0
 def manage_addRRDTemplate(self, id, REQUEST=None):
     """
     Add an RRDTemplate to this DeviceClass.
     """
     if not id: return self.callZenScreen(REQUEST)
     id = self.prepId(id)
     org = RRDTemplate.RRDTemplate(id)
     self.rrdTemplates._setObject(org.id, org)
     if REQUEST:
         messaging.IMessageSender(self).sendToBrowser(
             'Template Added', 'The "%s" template has been created.' % id)
         return self.callZenScreen(REQUEST)
Пример #2
0
    def getAllRRDTemplates(self, rrdts=None):
        """
        Return all RRDTemplates at this level and below in the object tree.
        If rrdts is provided then it must be a list of RRDTemplates which
        will be extended with the templates from here and returned.

        The original getAllRRDTemplates() method has been renamed
        getAllRRDTemplatesPainfully().  It walks the object tree looking
        for templates which is a very slow way of going about things.
        The newer RRDTemplate.YieldAllRRDTemplate() method uses the
        searchRRDTemplates catalog to speed things up dramatically.
        YieldAllRRDTemplates is smart enough to revert to
        getAllRRDTemplatesPainfully if the catalog is not present.

        The searchRRDTemplates catalog was added in 2.2
        """
        if rrdts is None:
            rrdts = []
        rrdts.extend(RRDTemplate.YieldAllRRDTemplates(self))
        return rrdts