remove has_signed_terms utility, introduce AstakosUser signed_terms function instead
[astakos] / snf-astakos-app / astakos / im / target / redirect.py
index 19784c3..3f667d7 100644 (file)
@@ -43,7 +43,7 @@ from urllib import quote
 from urlparse import urlunsplit, urlsplit, urlparse, parse_qsl
 
 from astakos.im.settings import COOKIE_NAME, COOKIE_DOMAIN
-from astakos.im.util import set_cookie, has_signed_terms
+from astakos.im.util import set_cookie
 
 import logging
 
@@ -51,9 +51,11 @@ logger = logging.getLogger(__name__)
 
 def login(request):
     """
-    If there is no `next` request parameter redirects to astakos index page displaying an error
-    message.
-    If the request user is authenticated and has signed the approval terms, redirects to `next` request parameter. If not, redirects to approval terms in order to return back here after agreeing with the terms.
+    If there is no ``next`` request parameter redirects to astakos index page
+    displaying an error message.
+    If the request user is authenticated and has signed the approval terms,
+    redirects to `next` request parameter. If not, redirects to approval terms
+    in order to return back here after agreeing with the terms.
     Otherwise, redirects to login in order to return back here after successful login.
     """
     next = request.GET.get('next')
@@ -67,7 +69,7 @@ def login(request):
     if request.user.is_authenticated():
         # if user has not signed the approval terms
         # redirect to approval terms with next the request path
-        if not has_signed_terms(request.user):
+        if not request.user.signed_terms():
             # first build next parameter
             parts = list(urlsplit(request.build_absolute_uri()))
             params = dict(parse_qsl(parts[3], keep_blank_values=True))