A restart of Zope and now it's working  :-)

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Todd Davis
Sent: Monday, December 31, 2007 1:02 PM
To: 'General discussion of using zenoss system'
Subject: RE: [zenoss-users] Creating a Portlet

Well, the comment didn't seem to make any difference.  I still get the 404
on /zport/getJSONEventList.

Is there a log or anything that will show Zope trying to load the method?

Here's the portion of __init__.py that deals with the method:

def getJSONEventList(self, path='/'):
    """
    Returns a list of unacknowledged events.
    The path parameter indicates the EventClass path to use.
    """
    path = '/zport/dmd/Events/' + path.strip('/')
    response = { 'columns': ['Device', 'Summary', 'Last'], 'data': [] }

    try:
        eventClass = self.dmd.unrestrictedTraverse(path)
    except KeyError:
        return simplejson.dumps(response)

    events = eventClass.getEventManager().getEventList(where='eventState=0')
    eventPairs = [ (e.device, e.summary, e.lastTime) for e in events ]

    for device, summary, lastTime in eventPairs:
        row = { 'Device': device, 'Summary': summary, 'Last': lastTime }
        response['data'].append(row)

    return simplejson.dumps(response)

from Products.ZenModel.ZentinelPortal import ZentinelPortal
ZentinelPortal.getJSONEventList = getJSONEventList

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Todd Davis
Sent: Monday, December 31, 2007 12:54 PM
To: 'General discussion of using zenoss system'
Subject: RE: [zenoss-users] Creating a Portlet

That would probably be it.  (That'll teach me to short-cut and leave out the
comments).  Thanks.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chet Luther
Sent: Monday, December 31, 2007 12:48 PM
To: General discussion of using zenoss system
Subject: Re: [zenoss-users] Creating a Portlet

> Has anyone had any luck creating a custom portlet following the  
> Developer's
> Guide?  I'm attempting to create a portlet that will show events  
> much like
> the Event Console.  I've followed the developer guide and everything  
> has
> worked with one exception:  my new method does not appear to be  
> getting
> registered in zport.
>
> My __init__.py has the following after the definition of my  
> getJSONEventList
> method:
>
> from Products.ZenModel.ZentinelPortal import ZentinelPortal
> ZentinelPortal.getJSONEventList = getJSONEventList
>
> After installing the zenpack, logs/Z2.log shows a 404 when trying to  
> pull
> /zport/getJSONEventList

Make sure that your getJSONEventList method is commented.

def getJSONEventList(self, ...):
        """
        This is the commend for my method.
        """
        code goes here..

Zope won't expose methods via URL unless they're commented.
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users



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



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



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

Reply via email to