Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Bug 1110801 - Minor cosmetic fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jezdez committed Mar 3, 2016
1 parent 341c85d commit 93db364
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions kuma/attachments/apps.py
Expand Up @@ -21,8 +21,8 @@ def ready(self):

AttachmentRevision = self.get_model('AttachmentRevision')
signals.post_delete.connect(self.after_revision_delete,
sender=AttachmentRevision,
dispatch_uid='attachments.revision.delete')
sender=AttachmentRevision,
dispatch_uid='attachments.revision.delete')

def after_revision_delete(self, **kwargs):
"""
Expand Down
3 changes: 1 addition & 2 deletions kuma/attachments/models.py
Expand Up @@ -2,7 +2,6 @@
from datetime import datetime

from django.conf import settings
from django.core.exceptions import MultipleObjectsReturned
from django.db import models
from django.db.utils import IntegrityError
from django_mysql.models import Model as MySQLModel
Expand Down Expand Up @@ -52,7 +51,7 @@ def get_file_url(self):
def attach(self, document, user, revision):
"""
When an attachment revision form is saved, this is used to attach
the new attachment revision to the given document via an intermediate
the new attachment to the given document via an intermediate M2M
model that stores some extra data like the user and the revision's
filename.
"""
Expand Down
4 changes: 2 additions & 2 deletions kuma/attachments/tests/test_models.py
Expand Up @@ -36,7 +36,7 @@ def setUp(self):
is_approved=True)
self.revision2.creator = self.test_user
self.revision2.file.save('filename2.txt',
ContentFile('Meh meh I am a test file.'))
ContentFile('Meh meh I am a test file.'))

def test_trash_revision(self):
self.assertEqual(TrashedAttachment.objects.count(), 0)
Expand Down Expand Up @@ -92,7 +92,7 @@ def test_delete_revision(self):
self.revision2.delete()
self.assertTrue(self.attachment.current_revision, self.revision)

# deleting the only revision deletes the attachment
# deleting the only revision left raises an IntegrityError exception
self.assertRaises(IntegrityError, self.revision.delete)

def test_permissions(self):
Expand Down
1 change: 1 addition & 0 deletions kuma/attachments/views.py
Expand Up @@ -90,6 +90,7 @@ def edit_attachment(request, document_slug, document_locale):
attachment = Attachment.objects.create(title=revision.title)
revision.attachment = attachment
revision.save()
# adding the attachment to the document's files (M2M)
attachment.attach(document, request.user, revision)
return redirect(document.get_edit_url())
else:
Expand Down

0 comments on commit 93db364

Please sign in to comment.