URL to diff comments returns 404 if at least one of diff-id and file-id are invalid.
Review Request #3401 — Created Oct. 6, 2012 and submitted
- Fixed URL to return 404. - Changed to use pk when getting a FileDiffResource queryset instead of local id to pass unit test.
Tested on local development server against custom urls.
Description | From | Last Updated |
---|---|---|
Nit: no newline needed. |
mike_conley | |
Spaces on either side of the = |
mike_conley | |
Nit: whitespace |
mike_conley | |
Whitespace in this block. Spaces on either side of the =. |
mike_conley | |
So, looking through the rest of resources.py, I think this pattern is more common: diff_revision = kwargs.get('diff_revision', None) review_id = … |
mike_conley | |
No spaces on either side of the equals when passing in named parameters. |
mike_conley | |
Needs to be < 80 columns. |
chipx86 | |
Put these in the parameter list to the function, defaulting to None. |
chipx86 | |
This is specific to FileDiffCommentResource, and so should live there. |
chipx86 | |
Is there a time when we would not have a review ID? |
chipx86 | |
Needs to be < 80 columns. Change *args, **kwargs to be on the next line. |
chipx86 | |
We should just reuse review_request_id. |
chipx86 | |
Blank line before this. |
chipx86 | |
Given the length of arguments and the wrapping, do one parameter per line, all aligned. That includes 'request' (on the … |
chipx86 |
-
Tests pass, and local testing verifies that this patch indeed fixes the problem. I went digging through resources.py to see what kind of patterns we use, and I've got a few recommendations. See below. Once those are fixed, I'll give my ship-it. -Mike
-
So, looking through the rest of resources.py, I think this pattern is more common: diff_revision = kwargs.get('diff_revision', None) review_id = kwargs.get('review_id', None) if diff_revision: # Do stuff elif review_id # Do other stuff
-
-
So, I made some comments on style, since I think that'll be helpful, but I have a couple questions/comments about the change. 1) Does this do anything for accessing actual individual comments with fake diff revisions or review IDs? (Is that broken too?) 2) Can you go into more detail on the second part of the change involving the local IDs? This doesn't seem completely right to me... 3) There should be unit tests covering each failure case, and making sure the results are expected. These should fail before this change, and pass after.
-
-
-
-
-
-
-
-
Given the length of arguments and the wrapping, do one parameter per line, all aligned. That includes 'request' (on the next line).