mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
Abstracted connection process somewhat.
Everything's data! Whee!
This commit is contained in:
parent
5979987c45
commit
9dbb11e4bd
@ -54,8 +54,6 @@ class Root(RestController):
|
|||||||
</html>
|
</html>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Consuming(RestController):
|
class Consuming(RestController):
|
||||||
exposed = True
|
exposed = True
|
||||||
|
|
||||||
@ -205,30 +203,20 @@ def rest_connect(dispatcher, location, controller, trailing_slash=True):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
root = Root()
|
|
||||||
|
|
||||||
hosting = Hosting(hosting_data)
|
|
||||||
client = Client(hosting_data)
|
|
||||||
service_provide = HostedService(hosting_data)
|
|
||||||
location = Location(hosting_data)
|
|
||||||
|
|
||||||
consuming = Consuming(consuming_data)
|
|
||||||
service_consume = ConsumedService(consuming_data)
|
|
||||||
consumed_host = ConsumedHost(consuming_data)
|
|
||||||
|
|
||||||
d = cherrypy.dispatch.RoutesDispatcher()
|
d = cherrypy.dispatch.RoutesDispatcher()
|
||||||
|
|
||||||
rest_connect(d, '/hosting/:client/:service/:location', location)
|
routing_pairs = (('/hosting/:client/:service/:location', Location(hosting_data)),
|
||||||
rest_connect(d, '/hosting/:client/:service', service_provide)
|
('/hosting/:client/:service', HostedService(hosting_data)),
|
||||||
rest_connect(d, '/hosting/:client', client)
|
('/hosting/:client', Client(hosting_data)),
|
||||||
rest_connect(d, '/hosting', hosting)
|
('/hosting', Hosting(hosting_data)),
|
||||||
|
('/consuming/:service/:host', ConsumedHost(consuming_data)),
|
||||||
|
('/consuming/:service', ConsumedService(consuming_data)),
|
||||||
|
('/consuming', Consuming(consuming_data)),
|
||||||
|
("/", Root()), )
|
||||||
|
|
||||||
rest_connect(d, '/consuming/:service/:host', consumed_host)
|
for location, handler in routing_pairs:
|
||||||
rest_connect(d, '/consuming/:service', service_consume)
|
rest_connect(d, location, handler)
|
||||||
rest_connect(d, '/consuming', consuming)
|
|
||||||
|
|
||||||
rest_connect(d, "/", root)
|
|
||||||
|
|
||||||
cherrypy.config.update({"server.socket_host": "0.0.0.0"})
|
cherrypy.config.update({"server.socket_host": "0.0.0.0"})
|
||||||
|
|
||||||
cherrypy.quickstart(hosting, "/", { "/": {'request.dispatch': d, }})
|
cherrypy.quickstart(root, "/", { "/": {'request.dispatch': d, }})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user