Mercurial > code > home > repos > homeauto
changeset 160:b5d6d9a6211f
add more date strings. Accept-header support
Ignore-this: 48067831b72ffc7b95ee433d3fa7245c
author | drewp@bigasterisk.com |
---|---|
date | Mon, 09 Feb 2015 00:11:03 -0800 |
parents | 4c62b6d416a7 |
children | b0c168f562e8 |
files | service/environment/environment.py |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/service/environment/environment.py Tue Jan 20 23:50:09 2015 -0800 +++ b/service/environment/environment.py Mon Feb 09 00:11:03 2015 -0800 @@ -28,6 +28,12 @@ Literal(now.strftime("%H:%M")))) g.add((DEV.environment, ROOM.localTimeToSecond, Literal(now.strftime("%H:%M:%S")))) + g.add((DEV.environment, ROOM.localDayOfWeek, + Literal(now.strftime("%A")))) + g.add((DEV.environment, ROOM.localMonthDay, + Literal(now.strftime("%B %e")))) + g.add((DEV.environment, ROOM.localDate, + Literal(now.strftime("%Y-%m-%d")))) for offset in range(-12, 7): d = now.date() + datetime.timedelta(days=offset) @@ -38,9 +44,10 @@ g.add((DEV.calendar, ROOM.twilight, ROOM['withinTwilight'] if isWithinTwilight(now) else ROOM['daytime'])) - - self.set_header('Content-type', 'application/x-trig') - self.write(g.asTrig()) + + ct, body = g.asAccepted(self.request.headers.get('accept')) + self.set_header('Content-type', ct) + self.write(body) from rdfdoc import Doc