Skip to content

Commit

Permalink
Fix #809. For some reason res_list does sometimes have no property …
Browse files Browse the repository at this point in the history
…`model` which broke the sharing API.
  • Loading branch information
flekschas committed Dec 8, 2015
1 parent 7bfb7cc commit f31d4d9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions refinery/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,12 @@ def transform_res_list(self, user, res_list, request, **kwargs):
# Try and retrieve a cached resource based on model name
# provide uniqueness between cached resources w/
# res_list_unique
res_list_unique = res_list.model.__name__
cache_check = cache.get("%s" % res_list_unique)
try:
res_list_unique = res_list.model.__name__
cache_check = cache.get("%s" % res_list_unique)
except:
res_list_unique = None
cache_check = None

if cache_check is None:
owned_res_set = Set(
Expand Down Expand Up @@ -184,7 +188,7 @@ def transform_res_list(self, user, res_list, request, **kwargs):
# Filter for query flags.
res_list = self.query_filtering(res_list, request.GET)

if user_uuid:
if user_uuid and res_list_unique:
cache.add("%s" % res_list_unique, res_list)
return res_list
else:
Expand Down

0 comments on commit f31d4d9

Please sign in to comment.