Skip navigation
1402 Views 0 Replies Latest reply: Jun 6, 2012 10:24 PM by Andrey Telepin RSS
Andrey Telepin Rank: White Belt 70 posts since
May 13, 2010
Currently Being Moderated

Jun 6, 2012 10:24 PM

housekeeping before object and ZenPack deletetion

Which work i could do for keep db consistency. My module create object which have two relations:


to 'parent'  ("interface", ToOne(ToManyCont,"Products.ZenModel.IpInterface","cbServicePolicy")),

to child     ("classmap", ToManyCont(ToOne, "ZenPacks.atelepin.cbCiscoQOS.cbClassMap", "cbServicePolicy")),


When i delete one of the  cbServicePolicy should i implement __del__() or manage_deleteComponent() on cbServicePolicy or  classmap or  both

now my implementation look like:



def __del__(self):


        Destructor for cbServicePolicy object





    def manage_deleteComponent(self, REQUEST=None):


        Delete cbServicePolicy and all douther cbClassMap


        for cp in self.classmap():






def __del__(self):


        Destructor for classmap object




When Module remove:



def remove(self, app, leaveObjects=False):

        #Remove installed Plugin in time instalation

        dc = app.zport.dmd.Devices.getOrganizer('Network/Router/Cisco')

        cpl = list(getattr(dc, 'zCollectorPlugins'))

        for plugin in self.newplugins:

                 if plugin in cpl: cpl.remove(plugin)

        dc.zCollectorPlugins = list(cpl)

        ZenPackBase.remove(self, app, leaveObjects)


        IpInterface._relations = tuple([x for x in IpInterface._relations if x[0] not in ['cbServicePolicy']])

        for dev in self.dmd.Devices.getSubDevices():

                 for int in dev.os.interfaces():


More Like This

  • Retrieving data ...


  • Correct Answers - 4 points
  • Helpful Answers - 2 points