Minor refactoring
Make the Bottle part of the application get its own DBus
connection rather than passing it in.
This partially enables generic WSGI app hosting.
Change-Id: I75334f83320bf6c1cad1a6bf5f2d1d82ca8dc470
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/obmc-rest b/obmc-rest
index e7dbbba..d8307ee 100644
--- a/obmc-rest
+++ b/obmc-rest
@@ -686,10 +686,10 @@
class RestApp(Bottle):
- def __init__(self, bus):
+ def __init__(self):
super(RestApp, self).__init__(autojson=False)
- self.bus = bus
- self.mapper = obmc.mapper.Mapper(bus)
+ self.bus = dbus.SystemBus()
+ self.mapper = obmc.mapper.Mapper(self.bus)
self.install_hooks()
self.install_plugins()
@@ -759,8 +759,7 @@
log.setLevel(logging.INFO)
log.addHandler(logging.StreamHandler(sys.stdout))
- bus = dbus.SystemBus()
- app = RestApp(bus)
+ app = RestApp()
default_cert = os.path.join(
sys.prefix, 'share', os.path.basename(__file__), 'cert.pem')