app/soc/views/helper/access.py
changeset 3067 371e1979ee6a
parent 3053 1dc307cb97d0
child 3068 1e01ffe9cc61
equal deleted inserted replaced
3066:45e2c3e70761 3067:371e1979ee6a
   981 
   981 
   982     return
   982     return
   983 
   983 
   984   @allowDeveloper
   984   @allowDeveloper
   985   @denySidebar
   985   @denySidebar
   986   def checkIsHostForProgram(self, django_args):
   986   def checkIsHostForProgram(self, django_args, 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     """
   991       logic: the logic used to look up for program entity; if not specified
       
   992         standard program_logic will be used      
       
   993     """
       
   994 
       
   995     if not logic:
       
   996       logic = program_logic
   992 
   997 
   993     program = program_logic.getFromKeyFields(django_args)
   998     program = program_logic.getFromKeyFields(django_args)
   994 
   999 
   995     if not program or program.status == 'invalid':
  1000     if not program or program.status == 'invalid':
   996       raise out_of_band.AccessViolation(message_fmt=DEF_NO_ACTIVE_PROGRAM_MSG)
  1001       raise out_of_band.AccessViolation(message_fmt=DEF_NO_ACTIVE_PROGRAM_MSG)