app/soc/views/helper/access.py
changeset 995 886c981fda2c
parent 992 e9f7d8e96b20
child 996 a6f67d4c297f
equal deleted inserted replaced
994:f05c02ba40fc 995:886c981fda2c
   383   raise out_of_band.LoginRequest(message_fmt=login_message_fmt)
   383   raise out_of_band.LoginRequest(message_fmt=login_message_fmt)
   384 
   384 
   385 
   385 
   386 def checkIsHostForProgram(kwargs):
   386 def checkIsHostForProgram(kwargs):
   387   """Raises an alternate HTTP response if Google Account has no Host entity
   387   """Raises an alternate HTTP response if Google Account has no Host entity
   388      for the specified program.
   388      for the specified Sponsor.
   389 
   389 
   390   Args:
   390   Args:
   391     request: a Django HTTP request
   391     request: a Django HTTP request
   392 
   392 
   393   Raises:
   393   Raises:
   400 
   400 
   401   checkAgreesToSiteToS(kwargs)
   401   checkAgreesToSiteToS(kwargs)
   402 
   402 
   403   user = user_logic.getForCurrentAccount()
   403   user = user_logic.getForCurrentAccount()
   404 
   404 
       
   405   if kwargs.get('scope_path'):
       
   406     scope_path = kwargs['scope_path']
       
   407   else:
       
   408     scope_path = kwargs['link_id']
       
   409 
   405   fields = {'user': user,
   410   fields = {'user': user,
   406             'scope_path': kwargs['scope_path'],
   411             'scope_path': scope_path,
   407             'state': 'active'}
   412             'state': 'active'}
   408 
   413 
   409   host = host_logic.getForFields(fields, unique=True)
   414   host = host_logic.getForFields(fields, unique=True)
   410 
   415 
   411   if host:
   416   if host: