too many logs written (bug 636397, comment #5)

This commit is contained in:
Andy McKay 2011-03-14 08:58:24 -07:00
Родитель 37447997b1
Коммит b36f1ff93b
2 изменённых файлов: 2 добавлений и 20 удалений

Просмотреть файл

@ -261,10 +261,6 @@ class ReviewBase:
file.status = status file.status = status
file.save() 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): def log_approval(self, action):
amo.log(action, self.addon, self.version, user=self.user.get_profile(), amo.log(action, self.addon, self.version, user=self.user.get_profile(),
created=datetime.now(), created=datetime.now(),
@ -319,7 +315,6 @@ class ReviewAddon(ReviewBase):
self.set_files(amo.STATUS_PUBLIC, self.version.files.all(), self.set_files(amo.STATUS_PUBLIC, self.version.files.all(),
copy_to_mirror=True) copy_to_mirror=True)
self.log_status()
self.log_approval(amo.LOG.APPROVE_VERSION) self.log_approval(amo.LOG.APPROVE_VERSION)
self.notify_email('%s_to_public' % self.review_type, self.notify_email('%s_to_public' % self.review_type,
_('Mozilla Add-ons: %s %s Fully Reviewed')) _('Mozilla Add-ons: %s %s Fully Reviewed'))
@ -333,7 +328,6 @@ class ReviewAddon(ReviewBase):
self.set_files(amo.STATUS_DISABLED, self.version.files.all(), self.set_files(amo.STATUS_DISABLED, self.version.files.all(),
hide_disabled_file=True) hide_disabled_file=True)
self.log_status()
self.log_approval(amo.LOG.REJECT_VERSION) self.log_approval(amo.LOG.REJECT_VERSION)
self.notify_email('%s_to_sandbox' % self.review_type, self.notify_email('%s_to_sandbox' % self.review_type,
# L10n: addon name, version string # L10n: addon name, version string
@ -358,7 +352,6 @@ class ReviewAddon(ReviewBase):
self.set_files(amo.STATUS_LITE, self.version.files.all(), self.set_files(amo.STATUS_LITE, self.version.files.all(),
copy_to_mirror=True) copy_to_mirror=True)
self.log_status()
self.log_approval(amo.LOG.PRELIMINARY_VERSION) self.log_approval(amo.LOG.PRELIMINARY_VERSION)
self.notify_email(template, self.notify_email(template,
# L10n: addon name, version string # L10n: addon name, version string

Просмотреть файл

@ -275,13 +275,8 @@ class TestReviewHelper(test_utils.TestCase):
def test_logs(self): def test_logs(self):
self.helper.set_data({'comments': 'something'}) self.helper.set_data({'comments': 'something'})
self.helper.handler.log_status()
self.helper.handler.log_approval(amo.LOG.APPROVE_VERSION) self.helper.handler.log_approval(amo.LOG.APPROVE_VERSION)
eq_(self.check_log_count(amo.LOG.APPROVE_VERSION.id), 1)
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]))
def test_notify_email(self): def test_notify_email(self):
self.helper.set_data(self.get_data()) 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) assert os.path.exists(self.file.mirror_file_path)
log = ActivityLog.objects.for_addons(self.helper.addon) eq_(self.check_log_count(amo.LOG.APPROVE_VERSION.id), 1)
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]))
def test_nomination_to_preliminary(self): def test_nomination_to_preliminary(self):
for status in NOMINATED_STATUSES: for status in NOMINATED_STATUSES:
@ -360,7 +351,6 @@ class TestReviewHelper(test_utils.TestCase):
assert os.path.exists(self.file.mirror_file_path) 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) eq_(self.check_log_count(amo.LOG.PRELIMINARY_VERSION.id), 1)
def test_nomination_to_sandbox(self): def test_nomination_to_sandbox(self):
@ -377,7 +367,6 @@ class TestReviewHelper(test_utils.TestCase):
eq_(mail.outbox[0].subject, '%s Reviewed' % self.preamble) eq_(mail.outbox[0].subject, '%s Reviewed' % self.preamble)
assert not os.path.exists(self.file.mirror_file_path) 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) eq_(self.check_log_count(amo.LOG.REJECT_VERSION.id), 1)
def test_nomination_to_super_review(self): def test_nomination_to_super_review(self):