Fix the file attachment aren't delete when removed from review requests
Review Request #7879 — Created Jan. 16, 2016 and submitted
File attachments aren't deleted when removed from review requests
I tested delete files manually.
1. I add s single file, then I delete it before publishing. The url r/xxxx/file/yyyy return 404.
2. I add a single file, then I delete it after publishing. The file exists.
3. I add 2 files, one is add before publishing and another is add after publishing. The result is same as above.Currently I am adding the unit test.
./reviewboard/manage.py test -- reviewboard.webapi.tests.test_file_attachment_draft
Description | From | Last Updated |
---|---|---|
local variable 'result' is assigned to but never used |
reviewbot | |
Col: 80 E501 line too long (84 > 79 characters) |
reviewbot | |
Add a blank line before this. This comment also doesn't make sense. We should say something along the lines of: … |
david | |
Conditionals in python don't require surrounding parentheses. We should also use .exists() instead of len(... .all()): if not file_attachment.review_request.exists(): |
david | |
We don't want to delete the draft--there may be other modifications to the review request. |
david | |
Add a blank line after this. |
david | |
Blank line between these. |
chipx86 | |
Col: 80 E501 line too long (86 > 79 characters) |
reviewbot | |
Make sure to add a unit test covering the case of a draft file attachment that was not published, to … |
chipx86 | |
Col: 80 E501 line too long (86 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (86 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (80 > 79 characters) |
reviewbot | |
Col: 52 E128 continuation line under-indented for visual indent |
reviewbot | |
Col: 52 E124 closing bracket does not match visual indentation |
reviewbot | |
Col: 1 W293 blank line contains whitespace |
reviewbot | |
Col: 1 W293 blank line contains whitespace |
reviewbot | |
Col: 9 E265 block comment should start with '# ' |
reviewbot | |
Col: 80 E501 line too long (85 > 79 characters) |
reviewbot | |
Col: 9 E265 block comment should start with '# ' |
reviewbot | |
Col: 80 E501 line too long (80 > 79 characters) |
reviewbot | |
Col: 51 E128 continuation line under-indented for visual indent |
reviewbot | |
Col: 51 E124 closing bracket does not match visual indentation |
reviewbot | |
Col: 80 E501 line too long (85 > 79 characters) |
reviewbot | |
Col: 9 E265 block comment should start with '# ' |
reviewbot | |
Col: 42 W291 trailing whitespace |
reviewbot | |
Col: 51 E128 continuation line under-indented for visual indent |
reviewbot | |
Col: 39 W291 trailing whitespace |
reviewbot | |
Col: 80 E501 line too long (86 > 79 characters) |
reviewbot | |
Can we also check not file_attachment.inactive_review_request.exists()? |
david | |
Can we add a check here that a new query to verify that FileAttachment.get(pk=file_attachment.pk) raises FileAttachment.DoesNotExist? |
david | |
Col: 80 E501 line too long (86 > 79 characters) |
reviewbot | |
Can you surround the conditional with parens instead of using the continuation character? |
david | |
This should be a comment, not a multiline string (prefix each line with #). |
david |
- Summary:
-
4054: File attachments aren't deleted when removed from review requestsFix the file attachment aren't delete when removed from review requests
- Testing Done:
-
+ I testd the single and multiple files delete before and after publish.
+ Only the file delete before publishing is deleted.
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/base_file_attachment.py Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/base_file_attachment.py
-
-
Add a blank line before this.
This comment also doesn't make sense. We should say something along the lines of:
# If this file attachment has never been made public, delete the model itself.
-
Conditionals in python don't require surrounding parentheses.
We should also use
.exists()
instead oflen(... .all())
:if not file_attachment.review_request.exists():
-
-
- Groups:
- Testing Done:
-
~ I testd the single and multiple files delete before and after publish.
~ Only the file delete before publishing is deleted. ~ I tested delete files manually.
~ 1. I add s single file, then I delete it before publishing. The url r/xxxx/file/yyyy return 404. + 2. I add a single file, then I delete it after publishing. The file exists. + 3. I add 2 files, one is add before publishing and another is add after publishing. The result is same as above. + + Currently I am adding the unit test.
- Description:
-
~ Fix the issue 4054: File attachments aren't deleted when removed from review requests
~ [WIP]Fix the issue 4054: File attachments aren't deleted when removed from review requests
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/base_file_attachment.py reviewboard/webapi/tests/test_file_attachment_draft.py Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/base_file_attachment.py reviewboard/webapi/tests/test_file_attachment_draft.py
-
-
-
-
-
-
-
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/base_file_attachment.py reviewboard/webapi/tests/test_file_attachment_draft.py Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/base_file_attachment.py reviewboard/webapi/tests/test_file_attachment_draft.py
-
-
-
-
-
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/base_file_attachment.py reviewboard/webapi/tests/test_file_attachment_draft.py Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/base_file_attachment.py reviewboard/webapi/tests/test_file_attachment_draft.py
-
-
-
-
-
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/base_file_attachment.py reviewboard/webapi/tests/test_file_attachment_draft.py Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/base_file_attachment.py reviewboard/webapi/tests/test_file_attachment_draft.py
-
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/base_file_attachment.py reviewboard/webapi/tests/test_file_attachment_draft.py Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/base_file_attachment.py reviewboard/webapi/tests/test_file_attachment_draft.py
-
-
Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/base_file_attachment.py reviewboard/webapi/tests/test_file_attachment_draft.py Tool: Pyflakes Processed Files: reviewboard/webapi/resources/base_file_attachment.py reviewboard/webapi/tests/test_file_attachment_draft.py
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/base_file_attachment.py reviewboard/webapi/tests/test_file_attachment_draft.py Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/base_file_attachment.py reviewboard/webapi/tests/test_file_attachment_draft.py
- Testing Done:
-
I tested delete files manually.
1. I add s single file, then I delete it before publishing. The url r/xxxx/file/yyyy return 404. 2. I add a single file, then I delete it after publishing. The file exists. 3. I add 2 files, one is add before publishing and another is add after publishing. The result is same as above. ~ Currently I am adding the unit test.
~ + + Currently I am adding the unit test.
+ ./reviewboard/manage.py test -- reviewboard.webapi.tests.test_file_attachment_draft
- Description:
-
~ Fix the issue 4054: File attachments aren't deleted when removed from review requests
~ File attachments aren't deleted when removed from review requests
-
Tool: Pyflakes Processed Files: reviewboard/webapi/resources/base_file_attachment.py Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/resources/base_file_attachment.py