From b36f1ff93b7f402f9733eaf642a9e7a6c6f2653d Mon Sep 17 00:00:00 2001 From: Andy McKay Date: Mon, 14 Mar 2011 08:58:24 -0700 Subject: [PATCH] too many logs written (bug 636397, comment #5) --- apps/editors/helpers.py | 7 ------- apps/editors/tests/test_helpers.py | 15 ++------------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/apps/editors/helpers.py b/apps/editors/helpers.py index 565cad325b..f7d933ca53 100644 --- a/apps/editors/helpers.py +++ b/apps/editors/helpers.py @@ -261,10 +261,6 @@ class ReviewBase: file.status = status file.save() - def log_status(self): - amo.log(amo.LOG.CHANGE_STATUS, self.addon, self.addon.status, - user=self.user.get_profile()) - def log_approval(self, action): amo.log(action, self.addon, self.version, user=self.user.get_profile(), created=datetime.now(), @@ -319,7 +315,6 @@ class ReviewAddon(ReviewBase): self.set_files(amo.STATUS_PUBLIC, self.version.files.all(), copy_to_mirror=True) - self.log_status() self.log_approval(amo.LOG.APPROVE_VERSION) self.notify_email('%s_to_public' % self.review_type, _('Mozilla Add-ons: %s %s Fully Reviewed')) @@ -333,7 +328,6 @@ class ReviewAddon(ReviewBase): self.set_files(amo.STATUS_DISABLED, self.version.files.all(), hide_disabled_file=True) - self.log_status() self.log_approval(amo.LOG.REJECT_VERSION) self.notify_email('%s_to_sandbox' % self.review_type, # L10n: addon name, version string @@ -358,7 +352,6 @@ class ReviewAddon(ReviewBase): self.set_files(amo.STATUS_LITE, self.version.files.all(), copy_to_mirror=True) - self.log_status() self.log_approval(amo.LOG.PRELIMINARY_VERSION) self.notify_email(template, # L10n: addon name, version string diff --git a/apps/editors/tests/test_helpers.py b/apps/editors/tests/test_helpers.py index e3433f06b3..2ccf558e54 100644 --- a/apps/editors/tests/test_helpers.py +++ b/apps/editors/tests/test_helpers.py @@ -275,13 +275,8 @@ class TestReviewHelper(test_utils.TestCase): def test_logs(self): self.helper.set_data({'comments': 'something'}) - self.helper.handler.log_status() self.helper.handler.log_approval(amo.LOG.APPROVE_VERSION) - - log = ActivityLog.objects.for_addons(self.helper.addon) - eq_(len(log), 2) - ids = set([l.action for l in log]) - eq_(ids, set([amo.LOG.CHANGE_STATUS.id, amo.LOG.APPROVE_VERSION.id])) + eq_(self.check_log_count(amo.LOG.APPROVE_VERSION.id), 1) def test_notify_email(self): self.helper.set_data(self.get_data()) @@ -337,11 +332,7 @@ class TestReviewHelper(test_utils.TestCase): assert os.path.exists(self.file.mirror_file_path) - log = ActivityLog.objects.for_addons(self.helper.addon) - eq_(len(log), 2) - ids = set([l.action for l in log]) - eq_(ids, set([amo.LOG.CHANGE_STATUS.id, - amo.LOG.APPROVE_VERSION.id])) + eq_(self.check_log_count(amo.LOG.APPROVE_VERSION.id), 1) def test_nomination_to_preliminary(self): for status in NOMINATED_STATUSES: @@ -360,7 +351,6 @@ class TestReviewHelper(test_utils.TestCase): assert os.path.exists(self.file.mirror_file_path) - eq_(self.check_log_count(amo.LOG.CHANGE_STATUS.id), 1) eq_(self.check_log_count(amo.LOG.PRELIMINARY_VERSION.id), 1) def test_nomination_to_sandbox(self): @@ -377,7 +367,6 @@ class TestReviewHelper(test_utils.TestCase): eq_(mail.outbox[0].subject, '%s Reviewed' % self.preamble) assert not os.path.exists(self.file.mirror_file_path) - eq_(self.check_log_count(amo.LOG.CHANGE_STATUS.id), 1) eq_(self.check_log_count(amo.LOG.REJECT_VERSION.id), 1) def test_nomination_to_super_review(self):