From 81e609a599afa68a05f65cae708f4b11e0f329c2 Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Thu, 13 Oct 2011 14:33:54 +0200 Subject: - lock rooms when cleaning - send access to retry page when room locked - fall back to regular login-page if user-login fails --- src/meetingtools/apps/room/views.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/meetingtools/apps/room/views.py') diff --git a/src/meetingtools/apps/room/views.py b/src/meetingtools/apps/room/views.py index e490aa2..f4da0df 100644 --- a/src/meetingtools/apps/room/views.py +++ b/src/meetingtools/apps/room/views.py @@ -362,6 +362,9 @@ def _random_key(length=20): return str().join(rg.choice(alphabet) for _ in range(length)) def _goto(request,room,clean=True,promote=False): + if room.is_locked(): + return respond_to(request, {"text/html": "apps/room/retry.html"}, {'room': room, 'wait': 10}) + api = ac_api_client(request, room.acc) now = time.time() lastvisit = room.lastvisit() @@ -381,10 +384,12 @@ def _goto(request,room,clean=True,promote=False): room.save() if room.self_cleaning: if (room.user_count == 0) and (abs(lastvisit - now) > GRACE): + room.lock() room = _clean(request,room) + room.unlock() - if room.host_count == 0 and room.allow_host: - return respond_to(request, {"text/html": "apps/room/launch.html"}, {'room': room}) + if room.host_count == 0 and room.allow_host: + return respond_to(request, {"text/html": "apps/room/launch.html"}, {'room': room}) else: room.save() @@ -401,10 +406,12 @@ def _goto(request,room,clean=True,promote=False): r = api.request('sco-info',{'sco-id':room.sco_id},True) urlpath = r.et.findtext('.//sco/url-path') if key: - user_client = ACPClient(room.acc.api_url, request.user.username, key, cache=False) - return user_client.redirect_to(room.acc.url+urlpath) - else: - return HttpResponseRedirect(room.acc.url+urlpath) + try: + user_client = ACPClient(room.acc.api_url, request.user.username, key, cache=False) + return user_client.redirect_to(room.acc.url+urlpath) + except Exception,e: + pass + return HttpResponseRedirect(room.acc.url+urlpath) ## Tagging -- cgit v1.1