From 525072bfd8c3781f2ced07f993caf94282995108 Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Thu, 12 May 2011 23:17:51 +0200 Subject: need to reformat stuff - work from json representation for feeds --- src/meetingtools/apps/room/views.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/meetingtools') diff --git a/src/meetingtools/apps/room/views.py b/src/meetingtools/apps/room/views.py index 2925853..c5fc8b8 100644 --- a/src/meetingtools/apps/room/views.py +++ b/src/meetingtools/apps/room/views.py @@ -25,6 +25,7 @@ from django_co_acls.models import allow, deny, acl, clear_acl from meetingtools.ac.api import ACPClient from tagging.models import Tag, TaggedItem import random, string +from django.utils.feedgenerator import rfc3339_date def _acc_for_user(user): (local,domain) = user.username.split('@') @@ -383,7 +384,7 @@ def _room2dict(room): return {'name':room.name, 'description':room.description, 'user_count':room.user_count, - 'lastupdated': timeAsrfc822(room.lastupdated), + 'updated': rfc3339_date(room.lastupdated), 'self_cleaning': room.self_cleaning, 'url': room.go_url()} @@ -398,21 +399,21 @@ def widget(request,tn): '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': now,'tags': tn,'rooms':rooms.all()}) + {'title':title,'description':title ,'edit':False,'date': now,'tags': tn,'rooms': [_room2dict(room) for room in 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.now()) + now = rfc3339_date(datetime.now()) return respond_to(request, {'text/html':'apps/room/list.html', 'application/json': json_response([_room2dict(room) for room in rooms]), 'application/atom+xml': 'apps/room/atom.xml', 'application/rss+xml': 'apps/room/rss2.xml', 'text/rss': 'apps/room/rss2.xml'}, - {'title':title,'description':title ,'edit':False,'baseurl': BASE_URL,'date': now,'tags': tn,'rooms':rooms.all()}) + {'title':title,'description':title ,'edit':False,'baseurl': BASE_URL,'date': now,'tags': tn,'rooms':[_room2dict(room) for room in rooms.all()]}) def _can_tag(request,tag): if tag in ('selfcleaning','public','private'): -- cgit v1.1