diff options
author | Leif Johansson <leifj@sunet.se> | 2011-05-12 22:17:30 +0200 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2011-05-12 22:17:30 +0200 |
commit | 6b262d57097bfe503e025fbe9804a204eb99a680 (patch) | |
tree | e95be275130888c6481063b09f550e323328fe07 /src/meetingtools/apps | |
parent | 5b21da3c7dd9005a580a8cf20a20b1fcff41d343 (diff) |
rfc822 times for the rss
Diffstat (limited to 'src/meetingtools/apps')
-rw-r--r-- | src/meetingtools/apps/room/views.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/meetingtools/apps/room/views.py b/src/meetingtools/apps/room/views.py index 680c8c1..327e1ca 100644 --- a/src/meetingtools/apps/room/views.py +++ b/src/meetingtools/apps/room/views.py @@ -385,28 +385,36 @@ def _room2dict(room): 'self_cleaning': room.self_cleaning, 'url': room.go_url()} +def timeAsrfc822 ( theTime ) : + import rfc822 + return rfc822 . formatdate ( rfc822 . mktime_tz ( rfc822 . parsedate_tz ( theTime . strftime ( "%a, %d %b %Y %H:%M:%S" ) ) ) ) + + @login_required def widget(request,tn): tags = tn.split('+') rooms = TaggedItem.objects.get_by_model(Room, tags) title = 'Rooms tagged with %s' % " and ".join(tags) + now = timeAsrfc822 ( datetime . datetime . now ( ) ) return respond_to(request, {'text/html':'apps/room/widget-test.html', 'application/json': json_response([_room2dict(room) for room in rooms]), 'application/rss+xml': 'apps/room/rss2.xml', 'text/rss': 'apps/room/rss2.xml'}, - {'title':title,'description':title ,'edit':False,'date': datetime.now(),'tags': tn,'rooms':rooms.all()}) + {'title':title,'description':title ,'edit':False,'date': now,'tags': tn,'rooms':rooms.all()}) +# should not require login def list_by_tag(request,tn): tags = tn.split('+') rooms = TaggedItem.objects.get_by_model(Room, tags) title = 'Rooms tagged with %s' % " and ".join(tags) + now = timeAsrfc822 ( datetime . datetime . now ( ) ) return respond_to(request, {'text/html':'apps/room/list.html', 'application/json': json_response([_room2dict(room) for room in rooms]), 'application/rss+xml': 'apps/room/rss2.xml', 'text/rss': 'apps/room/rss2.xml'}, - {'title':title,'description':title ,'edit':False,'date': datetime.now(),'tags': tn,'rooms':rooms.all()}) + {'title':title,'description':title ,'edit':False,'date': now,'tags': tn,'rooms':rooms.all()}) def _can_tag(request,tag): if tag in ('selfcleaning','public','private'): |