app/soc/views/helper/access.py
changeset 3068 1e01ffe9cc61
parent 3067 371e1979ee6a
child 3070 afd98e17a2b2
equal deleted inserted replaced
3067:371e1979ee6a 3068:1e01ffe9cc61
   981 
   981 
   982     return
   982     return
   983 
   983 
   984   @allowDeveloper
   984   @allowDeveloper
   985   @denySidebar
   985   @denySidebar
   986   def checkIsHostForProgram(self, django_args, logic):
   986   def checkIsHostForProgram(self, django_args, logic=program_logic):
   987     """Checks if the user is a host for the specified program.
   987     """Checks if the user is a host for the specified program.
   988 
   988 
   989     Args:
   989     Args:
   990       django_args: a dictionary with django's arguments
   990       django_args: a dictionary with django's arguments
   991       logic: the logic used to look up for program entity; if not specified
   991       logic: the logic used to look up for program entity
   992         standard program_logic will be used      
   992     """
   993     """
   993 
   994 
   994     program = logic.getFromKeyFields(django_args)
   995     if not logic:
       
   996       logic = program_logic
       
   997 
       
   998     program = program_logic.getFromKeyFields(django_args)
       
   999 
   995 
  1000     if not program or program.status == 'invalid':
   996     if not program or program.status == 'invalid':
  1001       raise out_of_band.AccessViolation(message_fmt=DEF_NO_ACTIVE_PROGRAM_MSG)
   997       raise out_of_band.AccessViolation(message_fmt=DEF_NO_ACTIVE_PROGRAM_MSG)
  1002 
   998 
  1003     new_args = {'scope_path': program.scope_path }
   999     new_args = {'scope_path': program.scope_path }