summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeif Johansson <leifj@sunet.se>2012-10-26 17:13:17 +0200
committerLeif Johansson <leifj@sunet.se>2012-10-26 17:13:17 +0200
commit0d218d69284497581c869ecc1606cfd173e87745 (patch)
treed26ee43830247439dfd32fa809e713da7da828dc
parent3e57ae213bf08bd332dc06fac7e9559d5a38e0bf (diff)
return absolute URLs in json metadata
-rw-r--r--meetingtools/apps/room/views.py6
-rw-r--r--meetingtools/utils.py4
2 files changed, 5 insertions, 5 deletions
diff --git a/meetingtools/apps/room/views.py b/meetingtools/apps/room/views.py
index 9d0292d..92c9f8d 100644
--- a/meetingtools/apps/room/views.py
+++ b/meetingtools/apps/room/views.py
@@ -449,14 +449,14 @@ def _goto(request,room,clean=True,promote=False):
## Tagging
-def _room2dict(room):
+def _room2dict(request,room):
return {'name':room.name,
'description':room.description,
'user_count':room.nusers(),
'host_count':room.nhosts(),
'updated': rfc3339_date(room.lastupdated),
'self_cleaning': room.self_cleaning,
- 'url': room.go_url()}
+ 'url': base_url(request,room.go_url())}
# should not require login
def list_by_tag(request,tn):
@@ -465,7 +465,7 @@ def list_by_tag(request,tn):
title = 'Rooms tagged with %s' % " and ".join(tags)
return respond_to(request,
{'text/html':'apps/room/list.html',
- 'application/json': json_response([_room2dict(room) for room in rooms],request)},
+ 'application/json': json_response([_room2dict(request,room) for room in rooms],request)},
{'title':title,
'description':title ,
'edit':False,
diff --git a/meetingtools/utils.py b/meetingtools/utils.py
index eee0d80..767da43 100644
--- a/meetingtools/utils.py
+++ b/meetingtools/utils.py
@@ -16,5 +16,5 @@ def session(request,key=None,val=None):
else:
return request.session
-def base_url(request):
- return "%s://%s/" % ({True: 'https',False:'http'}[request.is_secure()],request.get_host()) \ No newline at end of file
+def base_url(request,path="/"):
+ return "%s://%s%s" % ({True: 'https',False:'http'}[request.is_secure()],request.get_host(),path) \ No newline at end of file