Created new Learn handler.

This commit is contained in:
Nick Daly 2012-06-28 22:42:31 -05:00
parent 8870af39f3
commit b6b1736f43
2 changed files with 11 additions and 0 deletions

View File

@ -147,6 +147,7 @@ class Monitor(santiago.SantiagoMonitor):
('/consuming/:host/:service', ConsumedService(self.santiago)),
('/consuming/:host', ConsumedHost(self.santiago)),
('/consuming', Consuming(self.santiago)),
('/learn/:host/:service', Learn(self.santiago)),
("/stop", Stop(self.santiago)),
("/freedombuddy", root),
)
@ -390,3 +391,10 @@ class Stop(RestMonitor):
@cherrypy.tools.ip_filter()
def GET(self, **kwargs):
self.POST() # FIXME cause it's late and I'm tired.
class Learn(RestMonitor, santiago.SantiagoListener):
@cherrypy.tools.ip_filter()
def POST(self, host, service, **kwargs):
super(Learn, self).learn(host, service)
raise cherrypy.HTTPRedirect("/consuming/%s/%s" % (host, service))

View File

@ -12,6 +12,9 @@
<body>
<p>You are <a href="/consuming">consuming</a> $service from
<a href="/consuming/$host">$host</a> at:</p>
<form method="post" action="/learn/$host/$service">
<input type="submit" value="Learn More Locations?" />
</form>
#if $locations
<ul>
#for $location in $locations