app/soc/views/models/request.py
changeset 556 6c22492b6349
parent 554 68c7a1dd3c52
child 557 c6d9f8581730
equal deleted inserted replaced
555:3cdfb42d941b 556:6c22492b6349
   129       page_name: the page name displayed in templates as page and header title
   129       page_name: the page name displayed in templates as page and header title
   130       params: a dict with params for this View
   130       params: a dict with params for this View
   131       kwargs: not used
   131       kwargs: not used
   132     """
   132     """
   133 
   133 
   134     new_params = {}
   134     try:
   135     # TODO(SRabbelier) Change the redirect to something more useful
   135       self.checkAccess('list', request)
   136     new_params['list_redirect_action'] = '/'
   136     except out_of_band.Error, error:
   137     new_params['list_description'] = "An overview of your unhandled requests"
   137       return error.response(request)
   138     
   138 
   139     params = dicts.merge(params, new_params)
   139     params = dicts.merge(params, self._params)
   140     
   140 
   141     # get the current user
   141     # get the current user
   142     properties = {'account': users.get_current_user()}
   142     properties = {'account': users.get_current_user()}
   143     user_entity = user_logic.logic.getForFields(properties, unique=True)
   143     user_entity = user_logic.logic.getForFields(properties, unique=True)
   144     
   144 
       
   145     ######
       
   146     # Construct the Unhandled Request list
       
   147     ######
       
   148 
   145     # only select the requests for this user that haven't been handled yet
   149     # only select the requests for this user that haven't been handled yet
   146     filter = {'requester': user_entity,
   150     filter = {'requester': user_entity,
   147               'accepted' : True,
   151               'accepted' : True,
   148               'declined' : False}
   152               'declined' : False}
   149     
   153 
   150     
   154     # TODO(SRabbelier) make into a usefull redirect
   151     return list(request, page_name=page_name, params=params, filter=filter)
   155     # params['list_action'] = '/host/create'
       
   156     params['list_description'] = "An overview of your unhandled requests"
       
   157 
       
   158     uh = helper.lists.getListContent(request, params, self._logic, filter)
       
   159 
       
   160     ######
       
   161     # TODO(ljvderijk) Construct the other Request lists here
       
   162     ######
       
   163 
       
   164     contents = [uh]
       
   165     return self._list(request, params, contents, page_name)
   152 
   166 
   153   def _editSeed(self, request, seed):
   167   def _editSeed(self, request, seed):
   154     """See base.View._editGet().
   168     """See base.View._editGet().
   155     """
   169     """
   156 
   170