Hi there,
I'm trying to figure out ryu's event mechanism by sending and receiving an
event. Below is the test code I wrote:
---------
from ryu.base import app_manager
from ryu.controller import event, handler
class Hehe(app_manager.RyuApp):
class Event_1(event.EventBase):
def __init__(self):
super(Hehe.Event_1, self).__init__()
self.msg = 'event 1'
def __init__(self):
super(Hehe, self).__init__()
self.event = Hehe.Event_1()
self.register_observer(Hehe.Event_1, self.name)
def ping(self):
self.send_event_to_observers(self.Event_1())
print 'pinging...'
@handler.set_ev_cls(Hehe.Event_1)
def pong(self, event):
print 'Got ya', event.msg
---------
I put the script in ryu/app, and ran it with "ryu-manager event.py".
But I got a NameError stating that "name 'Hehe' is not defined" in line
"@handler.set_ev_cls(Hehe.Event_1)".
What do I miss? I need some help about this minimal example of raising and
handling an event(especially a self-defined event).
Thank you in advance.
--
Best regards,
Can Zhang
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel