Please forgive the amateur question, but I'm having trouble figuring out how to 
extend a method in Python.  I'm trying to build a command line app that lists 
and manipulates events:


Code:

import sys
import Globals
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
from transaction import commit

class MeritZenScriptBase(ZenScriptBase): 
    def __init__(self, noopts=0, app=None, connect=False):
        ZenScriptBase.__init__(self, noopts)

    def buildOptions(self):
        ZenScriptBase.buildOptions(self)
        self.parser.add_option('--search', dest="search",default="*", 
help="string to search for in event list")       

DeviceRoot = MeritZenScriptBase(connect=True).dmd

for event in DeviceRoot.ZenEventManager.getEventList(filter="whatever"):
     print event.device
     print event.summary




That just spits back out:

Code:
AttributeError: MeritZenScriptBase instance has no attribute 'dmd'



It's obviously not getting as far as the buildOptions part.  I was wondering 
what I'm doing wrong with inheriting the ZenScriptBase class?




-------------------- m2f --------------------

Read this topic online here:
http://forums.zenoss.com/viewtopic.php?p=26929#26929

-------------------- m2f --------------------



_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to