Commit f3d6202e authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Merge branch 'latest-quota' of https://code.grnet.gr/git/synnefo into latest-quota

parents d347d51e f4ee3f51
......@@ -1260,17 +1260,26 @@ def project_detail(request, application_id):
if form.is_valid():
sorting = form.cleaned_data.get('sorting')
return object_detail(
request,
queryset=ProjectApplication.objects.select_related(),
object_id=application_id,
template_name='im/projects/project_detail.html',
extra_context={
'resource_catalog':resource_catalog,
'sorting':sorting,
'addmembers_form':addmembers_form
}
)
rollback = False
try:
return object_detail(
request,
queryset=ProjectApplication.objects.select_related(),
object_id=application_id,
template_name='im/projects/project_detail.html',
extra_context={
'resource_catalog':resource_catalog,
'sorting':sorting,
'addmembers_form':addmembers_form
}
)
except:
rollback = True
finally:
if rollback == True:
transaction.rollback()
else:
transaction.commit()
@require_http_methods(["GET", "POST"])
@signed_terms_required
......@@ -1352,14 +1361,11 @@ def project_join(request, application_id):
logger.exception(e)
messages.error(request, _(astakos_messages.GENERIC_ERROR))
rollback = True
else:
return project_detail(request, application_id)
finally:
if rollback:
transaction.rollback()
else:
transaction.commit()
next = restrict_next(next, domain=COOKIE_DOMAIN)
return redirect(next)
......
......@@ -31,6 +31,8 @@
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
import logging
from time import time, mktime
from urlparse import urlparse
from urllib import quote, unquote
......@@ -40,6 +42,7 @@ from django.utils import simplejson as json
from synnefo.lib.pool.http import get_http_connection
logger = logging.getLogger(__name__)
def authenticate(token, authentication_url='http://127.0.0.1:8000/im/authenticate'):
p = urlparse(authentication_url)
......@@ -63,7 +66,7 @@ def authenticate(token, authentication_url='http://127.0.0.1:8000/im/authenticat
if status < 200 or status >= 300:
raise Exception(data, status)
return json.loads(data)
def user_for_token(token, authentication_url, override_users):
......@@ -95,10 +98,15 @@ def get_user(request, authentication_url='http://127.0.0.1:8000/im/authenticate'
if not user:
user = user_for_token(fallback_token, authentication_url, override_users)
if not user:
logger.warning("Cannot retrieve user details from %s",
authentication_url)
return
# use user uuid, instead of email, keep email/username reference to user_id
request.user_uniq = user['uuid']
request.user = user
request.user_uniq = user['uniq']
request.user_id = user['username']
return user
def get_token_from_cookie(request, cookiename):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment