summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meetingtools/apps/room/views.py9
-rw-r--r--meetingtools/multiresponse.py7
-rw-r--r--meetingtools/settings.py4
-rw-r--r--meetingtools/urls.py3
4 files changed, 14 insertions, 9 deletions
diff --git a/meetingtools/apps/room/views.py b/meetingtools/apps/room/views.py
index 2667a70..0cf3847 100644
--- a/meetingtools/apps/room/views.py
+++ b/meetingtools/apps/room/views.py
@@ -4,8 +4,7 @@ Created on Jan 31, 2011
@author: leifj
'''
from meetingtools.apps.room.models import Room, ACCluster
-from django.http import HttpResponseRedirect
-from meetingtools.multiresponse import respond_to
+from meetingtools.multiresponse import respond_to, redirect_to
from meetingtools.apps.room.forms import UpdateRoomForm, DeleteRoomForm
from django.shortcuts import get_object_or_404
from meetingtools.ac import ac_api_client, api
@@ -153,7 +152,7 @@ def update(request,id=None):
params['sco-source-id'] = r.et.find(".//sco").get('sco-source-id')
room = form.save()
room = _import_room(params['sco-id'],params['name'],params['source-sco-id'],params['url-path'],request.user,acc)
- return HttpResponseRedirect("/rooms#%d" % room.id)
+ return redirect_to("/rooms#%d" % room.id)
else:
form = UpdateRoomForm(instance=room)
_init_update_form(request, form, acc, my_meetings_sco_id)
@@ -219,7 +218,7 @@ def delete(request,id):
api = ac_api_client(request,room.acc)
api.request('sco-delete',{'sco-id':room.sco_id},raise_error=True)
room.delete()
- return HttpResponseRedirect("/rooms")
+ return redirect_to("/rooms")
else:
form = DeleteRoomForm()
@@ -250,5 +249,5 @@ def goto(request,room):
r = client.request('sco-info',{'sco-id':room.sco_id})
urlpath = r.et.findtext('.//sco/url-path')
- return HttpResponseRedirect(room.acc.url+urlpath)
+ return redirect_to(room.acc.url+urlpath)
\ No newline at end of file
diff --git a/meetingtools/multiresponse.py b/meetingtools/multiresponse.py
index b8c0960..f492cab 100644
--- a/meetingtools/multiresponse.py
+++ b/meetingtools/multiresponse.py
@@ -3,9 +3,11 @@ import re
import rfc822
from django.conf import settings
from django.shortcuts import render_to_response
-from django.http import HttpResponse, HttpResponseForbidden
+from django.http import HttpResponse, HttpResponseForbidden,\
+ HttpResponseRedirect
from django.utils import simplejson
from django.template import loader
+from meetingtools.settings import PREFIX_URL
default_suffix_mapping = {"\.htm(l?)$": "text/html",
"\.json$": "application/json",
@@ -60,3 +62,6 @@ def respond_to(request, template_mapping, dict={}, suffix_mapping=default_suffix
response = render_to_response(template,make_response_dict(request,dict))
response['Content-Type'] = "%s; charset=%s" % (content_type, settings.DEFAULT_CHARSET)
return response
+
+def redirect_to(path):
+ return HttpResponseRedirect("%s%s" % (PREFIX_URL,path)) \ No newline at end of file
diff --git a/meetingtools/settings.py b/meetingtools/settings.py
index 1228504..b672244 100644
--- a/meetingtools/settings.py
+++ b/meetingtools/settings.py
@@ -12,8 +12,8 @@ ADMINS = (
BASE_DIR = '.'
-BASE_URL = "http://localhost:8000"
-
+PREFIX_URL = ""
+BASE_URL = "http://localhost:8000%s" % PREFIX_URL
MANAGERS = ADMINS
DATABASES = {
diff --git a/meetingtools/urls.py b/meetingtools/urls.py
index 34aeb0a..785f90a 100644
--- a/meetingtools/urls.py
+++ b/meetingtools/urls.py
@@ -5,10 +5,11 @@ from django.contrib import admin
from django.http import HttpResponseRedirect
from django.contrib.auth.views import login, logout
from meetingtools.settings import ADMIN_MEDIA_ROOT, MEDIA_ROOT
+from meetingtools.multiresponse import redirect_to
admin.autodiscover()
def welcome(request):
- return HttpResponseRedirect('/rooms')
+ return redirect_to('/rooms')
urlpatterns = patterns('',
(r'^$',welcome),