Opened 12 years ago
Last modified 10 years ago
#465 accepted defect
Cannot delete attachments
Reported by: | Jakob Kramer | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | programming | Keywords: | test |
Cc: | deletesoftware@…, berkerpeksag | Parent Tickets: |
Description
Attachments cannot be deleted without deleting the whole "medium."
Attachments (2)
Change History (18)
comment:1 by , 12 years ago
Cc: | added |
---|
comment:2 by , 12 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:3 by , 12 years ago
Status: | assigned → accepted |
---|
comment:4 by , 12 years ago
Status: | accepted → in_progress |
---|
comment:5 by , 12 years ago
Owner: | removed |
---|---|
Status: | in_progress → accepted |
comment:6 by , 11 years ago
Hi, I added this functionality, and it seems to work well, but the main repository on gitorious doesn't allow merge requests, so how exactly does one contribute to it? I am new to the project. The main page says to submit contributions via this ticket tracker. So, it is in my repository mediagoblin/digital-dreamer-mediagoblin on gitorious in the branch 465-delete-attachment. Please check it out and send me a message in case it still needs some improvements.
by , 11 years ago
Attachment: | 465-delete-attachment.patch added |
---|
comment:7 by , 11 years ago
PS: I see you use patch files instead of merge requests, so I added it as a patch to this ticket's attachments.
comment:8 by , 10 years ago
Status: | accepted → review |
---|
comment:9 by , 10 years ago
This looks useful... someone needs to test this patch, but it looks promising at least.
comment:10 by , 10 years ago
Keywords: | test added |
---|
comment:11 by , 10 years ago
The above patch doesn't add any unit tests (unless I'm missing something?).
In particular, the delete
method on MediaAttachmentFile
and the media_confirm_delete_attachment
view should be tested to make sure they actually do what is expected.
by , 10 years ago
Attachment: | 465-unit-tests-v1.patch added |
---|
comment:13 by , 10 years ago
I've pushed the above patches (and a commit to fix whitespace errors!!!) to https://gitorious.org/mediagoblin/moggers87-mediagoblin/commits/issue-465>
Tests pass, but I haven't properly reviewed them yet.
comment:14 by , 10 years ago
Status: | review → accepted |
---|
In mediagoblin/db/models.py
:
except OSError, error:
should beexcept OSError as error:
'Deleted Attachment entry id "{0}"'.format(self.id)
: You could write{0}
as{}
.
In mediagoblin/tests/test_attachments.py
:
- Please regroup imports like this:
# stdlib imports # third party imports # mediagoblin import
class TestAttachments:
->class TestAttachments(object):
assert this_storage.file_exists(attachment_path) == True
: Drop== True
attachment.delete();
: Drop;
assert this_storage.file_exists(attachment_path) == False
->assert not this_storage.file_exists(attachment_path)
In mediagoblin/user_pages/views.py
:
- Please do not mix tabs and spaces.
if form.confirm.data is True:
->if form.confirm.data:
if ((request.user.has_privilege(u'admin') and request.user.id != media.uploader)):
->if (request.user.has_privilege(u'admin') and request.user.id != media.uploader)
comment:15 by , 10 years ago
Cc: | added |
---|---|
Milestone: | → 0.8.0 |
comment:16 by , 10 years ago
Milestone: | 0.8.0 |
---|
Gandaro, are you working on this? I'm switching the state to in_progress, but please unclaim if not the case.