Mercurial > code > home > repos > homeauto
changeset 939:f2a2d0cc22b4
more demo statements for use in examples
Ignore-this: e0e940387c56a720293a4727b02397b4
darcs-hash:20131013072331-312f9-ef155ca0296f4dc77bf558d6ad77fd32811c93a6
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sun, 13 Oct 2013 00:23:31 -0700 |
parents | dce8e2868b54 |
children | 45ea2f6123d3 |
files | service/environment/environment.py |
diffstat | 1 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/service/environment/environment.py Fri Oct 11 23:14:02 2013 -0700 +++ b/service/environment/environment.py Sun Oct 13 00:23:31 2013 -0700 @@ -18,16 +18,16 @@ ROOM = Namespace("http://projects.bigasterisk.com/room/") DEV = Namespace("http://projects.bigasterisk.com/device/") -class Index(PrettyErrorHandler, cyclone.web.RequestHandler): - def get(self): - self.write('this is envgraph: <a href="graph">rdf</a>') - class GraphHandler(PrettyErrorHandler, cyclone.web.RequestHandler): def get(self): g = StateGraph(ROOM.environment) now = datetime.datetime.now(tzlocal()) g.add((DEV.environment, ROOM.localHour, Literal(now.hour))) + g.add((DEV.environment, ROOM.localTimeToMinute, + Literal(now.strftime("%H:%M")))) + g.add((DEV.environment, ROOM.localTimeToSecond, + Literal(now.strftime("%H:%M:%S")))) for offset in range(-12, 7): d = now.date() + datetime.timedelta(days=offset) @@ -36,7 +36,8 @@ Literal(offset))) g.add((DEV.calendar, ROOM.twilight, - ROOM['withinTwilight'] if isWithinTwilight(now) else ROOM['daytime'])) + ROOM['withinTwilight'] if isWithinTwilight(now) else + ROOM['daytime'])) self.set_header('Content-type', 'application/x-trig') self.write(g.asTrig()) @@ -44,7 +45,8 @@ class Application(cyclone.web.Application): def __init__(self): handlers = [ - (r"/", Index), + (r"/()", cyclone.web.StaticFileHandler, + {"path": ".", "default_filename": "index.html"}), (r'/graph', GraphHandler), ] cyclone.web.Application.__init__(self, handlers)