Signed-off-by: YAMADA Hideki <[email protected]>
---
ryu/base/app_manager.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/ryu/base/app_manager.py b/ryu/base/app_manager.py
index 25b043a..59a8b4b 100644
--- a/ryu/base/app_manager.py
+++ b/ryu/base/app_manager.py
@@ -68,14 +68,14 @@ def unregister_app(app):
def require_app(app_name):
"""
Request the application to be loaded.
-
- This is used for "api" style modules, which is imported by a client
- application, to automatically load the corresponding server application.
"""
- frm = inspect.stack()[2] # skip a frame for "api" module
- m = inspect.getmodule(frm[0]) # client module
- m._REQUIRED_APP = getattr(m, '_REQUIRED_APP', [])
- m._REQUIRED_APP.append(app_name)
+ for frame_record in inspect.stack():
+ frame = frame_record[0]
+ module = inspect.getmodule(frame)
+ module._REQUIRED_APP = getattr(module, '_REQUIRED_APP', [])
+ for name, member in inspect.getmembers(module):
+ if inspect.isclass(member) and issubclass(member, RyuApp):
+ module._REQUIRED_APP.append(app_name)
class RyuApp(object):
--
1.7.9.5
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel