app/soc/views/models/notification.py
changeset 876 0c1329d4b514
parent 858 e79e7a22326f
child 890 b3bf833c4580
equal deleted inserted replaced
875:03c674f510d8 876:0c1329d4b514
    32 from soc.logic import validate
    32 from soc.logic import validate
    33 from soc.models import notification as notification_model
    33 from soc.models import notification as notification_model
    34 from soc.views import helper
    34 from soc.views import helper
    35 from soc.views import out_of_band
    35 from soc.views import out_of_band
    36 from soc.views.helper import access
    36 from soc.views.helper import access
       
    37 from soc.views.helper import decorators
    37 from soc.views.helper import lists as list_helper
    38 from soc.views.helper import lists as list_helper
    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 from soc.logic.models import notification as notification_logic
    41 from soc.logic.models import notification as notification_logic
    41 from soc.logic.models import user as user_logic
    42 from soc.logic.models import user as user_logic
   103 
   104 
   104     params = dicts.merge(params, new_params)
   105     params = dicts.merge(params, new_params)
   105 
   106 
   106     super(View, self).__init__(params=params)
   107     super(View, self).__init__(params=params)
   107 
   108 
       
   109   @decorators.merge_params
       
   110   @decorators.check_access
   108   def list(self, request, access_type,
   111   def list(self, request, access_type,
   109            page_name=None, params=None, filter=None):
   112            page_name=None, params=None, filter=None):
   110     """Lists all notifications that the current logged in user has stored.
   113     """Lists all notifications that the current logged in user has stored.
   111 
   114 
   112     for parameters see base.list()
   115     for parameters see base.list()
   113     """
   116     """
   114 
       
   115     params = dicts.merge(params, self._params)
       
   116 
       
   117     try:
       
   118       access.checkAccess(access_type, request, params['rights'])
       
   119     except out_of_band.Error, error:
       
   120       return helper.responses.errorResponse(error, request)
       
   121 
   117 
   122     # get the current user
   118     # get the current user
   123     user_entity = user_logic.logic.getForCurrentAccount()
   119     user_entity = user_logic.logic.getForCurrentAccount()
   124 
   120 
   125     # only select the notifications for this user so construct a filter
   121     # only select the notifications for this user so construct a filter