Add missing blank lines and remove unused checkIsInvited function from soc.views.helper.access module.
authorPawel Solyga <Pawel.Solyga@gmail.com>
Sat, 24 Jan 2009 11:04:15 +0000
changeset 948 bd956f419ad9
parent 947 67b41a13587a
child 949 07fdadbd6dc7
Add missing blank lines and remove unused checkIsInvited function from soc.views.helper.access module. Patch by: Pawel Solyga Review by: to-be-reviewed
app/soc/views/helper/access.py
--- a/app/soc/views/helper/access.py	Sat Jan 24 10:59:28 2009 +0000
+++ b/app/soc/views/helper/access.py	Sat Jan 24 11:04:15 2009 +0000
@@ -244,6 +244,7 @@
 
   raise out_of_band.LoginRequest(message_fmt=login_message_fmt)
 
+
 def checkCanCreateFromRequest(role_name):
   """Raises an alternate HTTP response if the specified request does not exist
      or if it's state is not group_accepted. 
@@ -269,6 +270,7 @@
     return
   return wrapper
 
+
 def checkIsMyGroupAcceptedRequest(request, args, kwargs):
   """Raises an alternate HTTP response if the specified request does not exist
      or if it's state is not group_accepted
@@ -296,6 +298,7 @@
 
   return
 
+
 def checkIsHost(request, args, kwargs):
   """Raises an alternate HTTP response if Google Account has no Host entity.
 
@@ -335,6 +338,7 @@
 
   raise out_of_band.LoginRequest(message_fmt=login_message_fmt)
 
+
 def checkIsHostForProgram(request, args, kwargs):
   """Raises an alternate HTTP response if Google Account has no Host entity
      for the specified program.
@@ -416,67 +420,6 @@
   raise out_of_band.LoginRequest(message_fmt=login_message_fmt)
 
 
-def checkIsInvited(request, args, kwargs):
-  """Returns an alternate HTTP response if Google Account has no Host entity
-     for the specified program.
-
-  Args:
-    request: a Django HTTP request
-
-   Raises:
-     AccessViolationResponse: if the required authorization is not met
-
-  Returns:
-    None if Host exists for the specified program, or a subclass of
-    django.http.HttpResponse which contains the alternate response
-    should be returned by the calling view.
-  """
-
-  try:
-    # if the current user is a developer we allow access
-    checkIsDeveloper(request, args, kwargs)
-    return
-  except out_of_band.Error:
-    pass
-
-  checkAgreesToSiteToS(request, args, kwargs)
-
-  login_message_fmt = DEF_DEV_LOGOUT_LOGIN_MSG_FMT % {
-      'role': 'a Program Administrator for this Program'}
-
-  splitpath = request.path.split('/')
-  splitpath = splitpath[1:] # cut off leading ''
-
-  if len(splitpath) < 4:
-    # TODO: perhaps this needs a better explanation?
-    deny(request, args, kwargs)
-
-  role = splitpath[0]
-  group_id = splitpath[2]
-  user_id = splitpath[3]
-
-  user = user_logic.getForFields({'account': users.get_current_user()},
-                                 unique=True)
-
-  if user_id != user.link_id:
-    # TODO: perhaps this needs a better explanation?
-    deny(request, args, kwargs)
-
-  properties = {
-      'link_id': user_id,
-      'role': role,
-      'scope_path': group_id,
-      'group_accepted': True,
-      }
-
-  request = request_logic.getForFields(properties, unique=True)
-
-  if request:
-    return
-
-  raise out_of_band.LoginRequest(message_fmt=login_message_fmt)
-
-
 def checkIsApplicationAccepted(app_logic):
   """Returns an alternate HTTP response if Google Account has no Club App
      entity for the specified Club.
@@ -609,6 +552,7 @@
 
   return wrapper
 
+
 def checkIsMyActiveRole(role_logic):
   """Returns an alternate HTTP response if there is no active role found for
      the current user using the given role_logic.