summaryrefslogtreecommitdiff
path: root/src/meetingtools/apps
diff options
context:
space:
mode:
authorLeif Johansson <leifj@sunet.se>2012-10-04 15:11:49 +0200
committerLeif Johansson <leifj@sunet.se>2012-10-04 15:11:49 +0200
commita8f72fab3a15120da2332c314836c1b521e9091a (patch)
treee9ea77c193b7c99e65b98caf2a982f396ab83144 /src/meetingtools/apps
parente6213dccb11e9b6f1111076d42032d0c0fb5b7af (diff)
settings cleanup
remove broken prefix-handler
Diffstat (limited to 'src/meetingtools/apps')
-rw-r--r--src/meetingtools/apps/auth/views.py9
-rw-r--r--src/meetingtools/apps/room/feeds.py3
-rw-r--r--src/meetingtools/apps/room/models.py10
-rw-r--r--src/meetingtools/apps/room/tasks.py7
-rw-r--r--src/meetingtools/apps/room/views.py23
5 files changed, 26 insertions, 26 deletions
diff --git a/src/meetingtools/apps/auth/views.py b/src/meetingtools/apps/auth/views.py
index e294b0c..ee23df3 100644
--- a/src/meetingtools/apps/auth/views.py
+++ b/src/meetingtools/apps/auth/views.py
@@ -13,9 +13,9 @@ from meetingtools.multiresponse import redirect_to, make_response_dict
from meetingtools.ac import ac_api_client
from django.shortcuts import render_to_response
from django.contrib import auth
-from django_co_connector.models import co_import_from_request, add_member,\
- remove_member
+from django_co_connector.models import co_import_from_request, add_member,remove_member
from meetingtools.apps.cluster.models import acc_for_user
+from django.conf import settings
def meta(request,attr):
v = request.META.get(attr)
@@ -123,6 +123,8 @@ def accounts_login_federated(request):
next = request.session.get("after_login_redirect", None)
if not next and request.GET.has_key('next'):
next = request.GET['next']
+ else:
+ next = settings.DEFAULT_URL
acc = acc_for_user(request.user)
with ac_api_client(request) as api:
@@ -163,4 +165,5 @@ def accounts_login_federated(request):
return redirect_to(next)
else:
pass
- return redirect_to(next)
+
+ return redirect_to(settings.LOGIN_URL)
diff --git a/src/meetingtools/apps/room/feeds.py b/src/meetingtools/apps/room/feeds.py
index 3dff05e..a72caaa 100644
--- a/src/meetingtools/apps/room/feeds.py
+++ b/src/meetingtools/apps/room/feeds.py
@@ -7,7 +7,6 @@ Created on May 13, 2011
from django.contrib.syndication.views import Feed
from meetingtools.apps.room.models import Room
from tagging.models import TaggedItem
-from meetingtools.settings import BASE_URL
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
from meetingtools.apps.room.views import room_recordings
from django.shortcuts import get_object_or_404
@@ -25,7 +24,7 @@ class TagsWrapper(object):
return self.title()
def link(self,ext):
- return "%s/room/+%s.%s" % (BASE_URL,"+".join(self.tags),ext)
+ return "/room/+%s.%s" % ("+".join(self.tags),ext)
class MeetingToolsFeed(Feed):
diff --git a/src/meetingtools/apps/room/models.py b/src/meetingtools/apps/room/models.py
index 249b1bf..2177b24 100644
--- a/src/meetingtools/apps/room/models.py
+++ b/src/meetingtools/apps/room/models.py
@@ -12,7 +12,7 @@ from django.contrib.auth.models import User
from meetingtools.apps.cluster.models import ACCluster
import time
import tagging
-from meetingtools.settings import BASE_URL, LOCK_DIR
+from meetingtools.settings import LOCK_DIR
from django.db.models.signals import post_save
from tagging.models import Tag
import os
@@ -102,16 +102,16 @@ class Room(models.Model):
return int(time.mktime(self.lastupdated.timetuple()))
def go_url(self):
- return "%s/go/%s" % (BASE_URL,self.urlpath)
+ return "/go/%s" % self.urlpath
def go_url_internal(self):
- return "%s/go/%d" % (BASE_URL,self.id)
+ return "/go/%d" % self.id
def permalink(self):
- return "%s/room/%d" % (BASE_URL,self.id)
+ return "/room/%d" % self.id
def recordings_url(self):
- return "%s/room/%d/recordings" % (BASE_URL,self.id)
+ return "/room/%d/recordings" % self.id
def nusers(self):
if self.user_count == None:
diff --git a/src/meetingtools/apps/room/tasks.py b/src/meetingtools/apps/room/tasks.py
index feb0ec5..ce9f275 100644
--- a/src/meetingtools/apps/room/tasks.py
+++ b/src/meetingtools/apps/room/tasks.py
@@ -17,9 +17,8 @@ from datetime import datetime,timedelta
from lxml import etree
from django.db.models import Q
from django.contrib.humanize.templatetags import humanize
-from meetingtools.apps.userprofile.models import profile
+from django.conf import settings
from django.core.mail import send_mail
-from meetingtools.settings import NOREPLY, BASE_URL
def _owner_username(api,sco):
logging.debug(sco)
@@ -231,7 +230,7 @@ def send_message(user,subject,message):
try:
p = user.get_profile()
if p and p.email:
- send_mail(subject,message,NOREPLY,[p.email])
+ send_mail(subject,message,settings.NOREPLY,[p.email])
else:
logging.info("User %s has no email address - email not sent" % user.username)
except ObjectDoesNotExist:
@@ -248,4 +247,4 @@ def clean_old_rooms():
with ac_api_client(acc) as api:
for room in Room.objects.filter(lastvisited__lt=then):
logging.debug("room %s was last used %s" % (room.name,humanize.naturalday(room.lastvisited)))
- send_message.apply_async([room.creator,"You have an unused meetingroom at %s" % BASE_URL,"Do you still need %s (%s)?" % (room.name,room.permalink())]) \ No newline at end of file
+ send_message.apply_async([room.creator,"You have an unused meetingroom at %s" % acc.name ,"Do you still need %s (%s)?" % (room.name,room.permalink())]) \ No newline at end of file
diff --git a/src/meetingtools/apps/room/views.py b/src/meetingtools/apps/room/views.py
index e612141..c46ab6e 100644
--- a/src/meetingtools/apps/room/views.py
+++ b/src/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 meetingtools.multiresponse import respond_to, redirect_to, json_response,\
- timeAsrfc822
+from meetingtools.multiresponse import respond_to, redirect_to, json_response
from meetingtools.apps.room.forms import DeleteRoomForm,\
CreateRoomForm, ModifyRoomForm, TagRoomForm
from django.shortcuts import get_object_or_404
@@ -15,10 +14,9 @@ from meetingtools.apps import room
from django.contrib.auth.decorators import login_required
import logging
from pprint import pformat
-from meetingtools.utils import session
+from meetingtools.utils import session, base_url
import time
-from meetingtools.settings import GRACE, BASE_URL, DEFAULT_TEMPLATE_SCO,\
- IMPORT_TTL
+from django.conf import settings
from django.utils.datetime_safe import datetime
from django.http import HttpResponseRedirect
from django.core.exceptions import ObjectDoesNotExist
@@ -27,7 +25,7 @@ from meetingtools.ac.api import ACPClient
from tagging.models import Tag, TaggedItem
import random, string
from django.utils.feedgenerator import rfc3339_date
-from django.views.decorators.cache import cache_control, never_cache
+from django.views.decorators.cache import never_cache
from meetingtools.apps.cluster.models import acc_for_user
from django.contrib.auth.models import User
import iso8601
@@ -111,13 +109,14 @@ def view(request,id):
{'user':request.user,
'rooms':[room],
'title': room.name,
+ 'baseurl': base_url(request),
'active': True,
})
def _init_update_form(request,form,acc,my_meetings_sco_id):
if form.fields.has_key('urlpath'):
- url = BASE_URL
- form.fields['urlpath'].widget.prefix = url.rstrip('/')+"/"
+ url = base_url(request)
+ form.fields['urlpath'].widget.prefix = url
if form.fields.has_key('source_sco_id'):
form.fields['source_sco_id'].widget.choices = [('','-- select template --')]+[r for r in _user_templates(request,acc,my_meetings_sco_id)]
@@ -234,7 +233,7 @@ def _import_room(request,acc,r):
modified = False
room = None
- if room and (abs(room.lastupdate() - time.time()) < IMPORT_TTL):
+ if room and (abs(room.lastupdate() - time.time()) < settings.IMPORT_TTL):
return room
if r.has_key('urlpath'):
@@ -406,7 +405,7 @@ def _goto(request,room,clean=True,promote=False):
if clean:
# don't clean the room unless you get a good status code from the call to the usermanager api above
if room.self_cleaning and room.user_count == 0:
- if (room.user_count == 0) and (abs(lastvisit - now) > GRACE):
+ if (room.user_count == 0) and (abs(lastvisit - now) > settings.GRACE):
room.lock("Locked for cleaning")
try:
room = _clean(request,room)
@@ -465,7 +464,7 @@ def list_by_tag(request,tn):
'description':title ,
'edit':False,
'active':len(rooms) == 1,
- 'baseurl': BASE_URL,
+ 'baseurl': base_url(request),
'tagstring': tn,
'rooms':rooms})
@@ -483,7 +482,7 @@ def list_and_import_by_tag(request,tn):
'description':title ,
'edit':False,
'active':len(rooms) == 1,
- 'baseurl': BASE_URL,
+ 'baseurl': base_url(request),
'tagstring': tn,
'rooms':rooms})