New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jkmarx/limit events api response #2944
Conversation
refinery/core/serializers.py
Outdated
@@ -34,13 +34,17 @@ def get_is_owner(self, data_set): | |||
logger.error("Request is missing a user: %s", e) | |||
return False | |||
return user_request == owner | |||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left out else, fixes null response from API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just return
in the first try
? And you could do the same thing in the except
:
def get_is_owner(self, data_set):
try:
return data_set.is_owner
except:
owner = data_set.get_owner()
try:
return owner == self.context.get('request').user
except AttributeError as e:
logger.error("Request is missing a user: %s", e)
return False
refinery/core/test_views.py
Outdated
self.assertEqual( | ||
json.loads(get_response.content), | ||
get_response.data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reorder response (api now handles it)
refinery/core/serializers.py
Outdated
@@ -34,13 +34,17 @@ def get_is_owner(self, data_set): | |||
logger.error("Request is missing a user: %s", e) | |||
return False | |||
return user_request == owner | |||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just return
in the first try
? And you could do the same thing in the except
:
def get_is_owner(self, data_set):
try:
return data_set.is_owner
except:
owner = data_set.get_owner()
try:
return owner == self.context.get('request').user
except AttributeError as e:
logger.error("Request is missing a user: %s", e)
return False
refinery/core/serializers.py
Outdated
|
||
def get_public(self, data_set): | ||
try: | ||
data_set.public | ||
except: | ||
is_public = data_set.is_public() | ||
return is_public | ||
else: | ||
return data_set.public |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto: You don't want to do too much in a try
, but just returning isn't going cause a different exception
).data, | ||
'group': None, | ||
'user': UserSerializer(self.user).data, | ||
'type': 'UPDATE', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally the type was one of the CRUD verbs, so I'm surprised this isn't CREATE
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... but it looks like it's just being copied from below, so not a new issue...
Codecov Report
@@ Coverage Diff @@
## develop #2944 +/- ##
===========================================
- Coverage 59.39% 59.17% -0.22%
===========================================
Files 434 434
Lines 27345 27109 -236
Branches 1279 1273 -6
===========================================
- Hits 16242 16043 -199
+ Misses 11103 11066 -37
Continue to review full report at Codecov.
|
Ref #2909