app/soc/views/models/request.py
changeset 876 0c1329d4b514
parent 858 e79e7a22326f
child 890 b3bf833c4580
equal deleted inserted replaced
875:03c674f510d8 876:0c1329d4b514
    33 from soc.logic.models import sponsor as sponsor_logic
    33 from soc.logic.models import sponsor as sponsor_logic
    34 from soc.logic.models import user as user_logic
    34 from soc.logic.models import user as user_logic
    35 from soc.views import helper
    35 from soc.views import helper
    36 from soc.views import out_of_band
    36 from soc.views import out_of_band
    37 from soc.views.helper import access
    37 from soc.views.helper import access
       
    38 from soc.views.helper import decorators
    38 from soc.views.helper import redirects
    39 from soc.views.helper import redirects
    39 from soc.views.models import base
    40 from soc.views.models import base
    40 
    41 
    41 import soc.models.request
    42 import soc.models.request
    42 import soc.logic.models.request
    43 import soc.logic.models.request
   120 
   121 
   121     params = dicts.merge(params, new_params)
   122     params = dicts.merge(params, new_params)
   122 
   123 
   123     super(View, self).__init__(params=params)
   124     super(View, self).__init__(params=params)
   124 
   125 
   125 
   126   @decorators.merge_params
       
   127   @decorators.check_access
   126   def listSelf(self, request, access_type,
   128   def listSelf(self, request, access_type,
   127                page_name=None, params=None, **kwargs):
   129                page_name=None, params=None, **kwargs):
   128     """Displays the unhandled requests for this user.
   130     """Displays the unhandled requests for this user.
   129 
   131 
   130     Args:
   132     Args:
   131       request: the standard Django HTTP request object
   133       request: the standard Django HTTP request object
   132       page_name: the page name displayed in templates as page and header title
   134       page_name: the page name displayed in templates as page and header title
   133       params: a dict with params for this View
   135       params: a dict with params for this View
   134       kwargs: not used
   136       kwargs: not used
   135     """
   137     """
   136 
       
   137     params = dicts.merge(params, self._params)
       
   138     params['logic'] = self._logic
       
   139 
       
   140     try:
       
   141       access.checkAccess(access_type, request, params['rights'])
       
   142     except out_of_band.Error, error:
       
   143       return helper.responses.errorResponse(error, request)
       
   144 
   138 
   145     # get the current user
   139     # get the current user
   146     properties = {'account': users.get_current_user()}
   140     properties = {'account': users.get_current_user()}
   147     user_entity = user_logic.logic.getForFields(properties, unique=True)
   141     user_entity = user_logic.logic.getForFields(properties, unique=True)
   148 
   142