Skip to content

Commit

Permalink
check pagination / sorting of entitlement requests OpenBankProject#76
Browse files Browse the repository at this point in the history
  • Loading branch information
PengfeiLi0218 committed Feb 8, 2019
1 parent 739c44d commit 61d98c5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apimanager/entitlementrequests/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ def get_context_data(self, **kwargs):
try:
urlpath = '/entitlement-requests'
entitlement_requests = api.get(urlpath)
if 'code' in entitlement_requests and entitlement_requests['code']==403:
if 'code' in entitlement_requests and entitlement_requests['code']>=400:
messages.error(self.request, entitlement_requests['message'])
entitlement_requests=[]
else:
entitlement_requests = entitlement_requests['entitlement_requests']
entitlement_requests = FilterTime(context, self.request.GET, 'created') \
.apply(entitlement_requests)
entitlement_requests = self.scrub(entitlement_requests)
entitlement_requests = sorted(entitlement_requests, key=lambda k: k['created'], reverse=True)
except APIError as err:
messages.error(self.request, err)
except:
Expand Down

0 comments on commit 61d98c5

Please sign in to comment.