app/soc/views/helper/redirects.py
changeset 3050 5f135cfac194
parent 2971 4337dfc33633
equal deleted inserted replaced
3049:45b5738619d3 3050:5f135cfac194
   262 
   262 
   263 def getProcessRequestRedirect(entity, _):
   263 def getProcessRequestRedirect(entity, _):
   264   """Returns the redirect for processing the specified request entity.
   264   """Returns the redirect for processing the specified request entity.
   265   """
   265   """
   266 
   266 
   267   result = '/%s/process_request/%s/%s' % (
   267   from soc.views.models.role import ROLE_VIEWS
   268       entity.role, entity.scope_path, entity.link_id)
   268 
       
   269   role_view = ROLE_VIEWS[entity.role]
       
   270 
       
   271   result = '/%s/process_request/%s' % (
       
   272       role_view.getParams()['url_name'], entity.key().id_or_name())
   269 
   273 
   270   return result
   274   return result
   271 
   275 
   272 
   276 
   273 def getManageRedirect(entity, params):
   277 def getManageRedirect(entity, params):
   301 
   305 
   302 
   306 
   303 def getInviteAcceptedRedirect(entity, _):
   307 def getInviteAcceptedRedirect(entity, _):
   304   """Returns the redirect for accepting an invite.
   308   """Returns the redirect for accepting an invite.
   305   """
   309   """
   306   # TODO: redesign this redirect to use ROLE_VIEWS from the Role View
   310 
   307   return '/%s/accept_invite/%s/%s' % (
   311   from soc.views.models.role import ROLE_VIEWS
   308       entity.role, entity.scope_path, entity.link_id)
   312 
       
   313   role_params = ROLE_VIEWS[entity.role].getParams()
       
   314 
       
   315   return '/%s/accept_invite/%s' % (
       
   316       role_params['url_name'], entity.key().id_or_name())
   309 
   317 
   310 
   318 
   311 def getInviteProcessRedirect(entity, _):
   319 def getInviteProcessRedirect(entity, _):
   312   """Returns the redirect for processing an invite.
   320   """Returns the redirect for processing an invite.
   313   """
   321   """
   314 
   322 
   315   return '/request/process_invite/%s/%s/%s' % (
   323   return '/request/process_invite/%s' % (
   316       entity.scope_path, entity.role, entity.link_id)
   324       entity.key().id_or_name())
   317 
   325 
   318 
   326 
   319 def getApplicantRedirect(entity, params):
   327 def getApplicantRedirect(entity, params):
   320   """Returns the redirect for processing accepted Applications.
   328   """Returns the redirect for processing accepted Applications.
   321   """
   329   """