Removed now-obsolete getAltResponse* methods from simple.py
authorSverre Rabbelier <srabbelier@gmail.com>
Thu, 09 Oct 2008 23:50:00 +0000
changeset 295 651d9eabdef7
parent 294 1fdaab4a6ef2
child 296 b02dd2a5f329
Removed now-obsolete getAltResponse* methods from simple.py The getAltResponse* methods have been replaced by the check* methods in soc.logic.helper.access. Patch by: Sverre Rabbelier Reviewed by: Pawel Solyga, Augie Fackler, Todd Larsen Reviewed at: http://codereviews.googleopensourceprograms.com/1601 Review id: 1601
app/soc/views/simple.py
--- a/app/soc/views/simple.py	Thu Oct 09 23:48:20 2008 +0000
+++ b/app/soc/views/simple.py	Thu Oct 09 23:50:00 2008 +0000
@@ -141,108 +141,3 @@
   
   return helper.responses.respond(request, login_templates, context=context)
 
-
-def getAltResponseIfNotLoggedIn(request, context=None,
-                                template=DEF_LOGIN_TMPL, id=None,
-                                login_message_fmt=DEF_LOGIN_MSG_FMT):
-  """Returns an alternate HTTP response if Google Account is not logged in.
-
-  Args:
-    request: the standard django request object
-    context: the context supplied to the template (implements dict)
-    template: the "sibling" template (or a search list of such templates)
-      from which to construct the public.html template name (or names)
-    id: a Google Account (users.User) object, or None, in which case
-      the current logged-in user is used
-
-  Returns:
-    None if id is logged in, or a subclass of django.http.HttpResponse
-    which contains the alternate response that should be returned by the
-    calling view.
-  """
-  id = id_user.getIdIfMissing(id)
-
-  if id:
-    # a Google Account is logged in, so no need to ask user to sign in  
-    return None
-
-  # if missing, create default template context for use with any templates
-  context = helper.responses.getUniversalContext(request, context=context)
-
-  return requestLogin(request, template, context,
-                      login_message_fmt=login_message_fmt)
-
-DEF_NO_USER_LOGIN_MSG_FMT = ugettext_lazy(
-    'Please create <a href="/user/profile">User Profile</a>'
-    ' in order to view this page.')
-
-def getAltResponseIfNotUser(request, context=None,
-                                template=DEF_LOGIN_TMPL, id=None,
-                                login_message_fmt=DEF_LOGIN_MSG_FMT):
-  """Returns an alternate HTTP response if Google Account has no User entity.
-
-  Args:
-    request: the standard django request object
-    context: the context supplied to the template (implements dict)
-    template: the "sibling" template (or a search list of such templates)
-      from which to construct the public.html template name (or names)
-    id: a Google Account (users.User) object, or None, in which case
-      the current logged-in user is used
-
-  Returns:
-    None if User exists for id, or a subclass of django.http.HttpResponse
-    which contains the alternate response that should be returned by the
-    calling view.
-  """
-  user_exist = id_user.isIdUser(id)
-
-  if user_exist:
-    return None
-
-  # if missing, create default template context for use with any templates
-  context = helper.responses.getUniversalContext(request, context=context)
-
-  return requestLogin(request, template, context,
-                      login_message_fmt=DEF_NO_USER_LOGIN_MSG_FMT)
-
-DEF_DEV_LOGIN_MSG_FMT = ugettext_lazy(
-    'Please <a href="%(sign_in)s">sign in</a>'
-    ' as a site developer to view this page.')
-
-DEF_DEV_LOGOUT_LOGIN_MSG_FMT = ugettext_lazy(
-    'Please <a href="%(sign_out)s">sign out</a>'
-    ' and <a href="%(sign_in)s">sign in</a>'
-    ' again as a site developer to view this page.')
-
-def getAltResponseIfNotDeveloper(request, context=None,
-                                 template=DEF_LOGIN_TMPL, id=None):
-  """Returns an alternate HTTP response if Google Account is not a Developer.
-
-  Args:
-    request: the standard django request object
-    context: the context supplied to the template (implements dict)
-    template: the "sibling" template (or a search list of such templates)
-      from which to construct the public.html template name (or names)
-    id: a Google Account (users.User) object, or None, in which case
-      the current logged-in user is used
-
-  Returns:
-    None if id is logged in and logged-in user is a Developer, or a
-    subclass of django.http.HttpResponse which contains the alternate
-    response that should be returned by the calling view.
-  """
-  id = id_user.getIdIfMissing(id)
-
-  # if missing, create default template context for use with any templates
-  context = helper.responses.getUniversalContext(request, context=context)
-
-  if not id:
-    return requestLogin(request, template, context,
-        login_message_fmt=DEF_DEV_LOGIN_MSG_FMT)
-
-  if not id_user.isIdDeveloper(id=id):
-    return requestLogin(request, template, context,
-        login_message_fmt=DEF_DEV_LOGOUT_LOGIN_MSG_FMT)
-
-  # Google Account is logged in and is a Developer, so no need for sign in
-  return None