From 22643b333ab813b0a198c9e979f2663bc60d0679 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 10 Mar 2014 14:48:23 -0700 Subject: [PATCH] Fix bulk validation errors for add-ons without reviewed versions. --- apps/zadmin/forms.py | 4 - apps/zadmin/tasks.py | 81 +++++++++++-------- .../templates/zadmin/validation-email.txt | 15 ++-- 3 files changed, 56 insertions(+), 44 deletions(-) diff --git a/apps/zadmin/forms.py b/apps/zadmin/forms.py index f81f65b226..dc1cc67b3d 100644 --- a/apps/zadmin/forms.py +++ b/apps/zadmin/forms.py @@ -122,10 +122,6 @@ class NotifyForm(happyforms.Form): Template(data).render(Context({})) except TemplateSyntaxError, err: raise forms.ValidationError(err) - for name in varname.findall(data): - if name not in self.variable_names: - raise forms.ValidationError( - u'Variable {{%s}} is not a valid variable' % name) return data def clean_text(self): diff --git a/apps/zadmin/tasks.py b/apps/zadmin/tasks.py index 181046b9cf..5cfc448771 100644 --- a/apps/zadmin/tasks.py +++ b/apps/zadmin/tasks.py @@ -286,46 +286,59 @@ def notify_compatibility(users, job, data, **kw): for user in users: stats['processed'] += 1 - for a in chain(user.passing_addons, user.failing_addons): - results = job.result_set.filter(file__version__addon=a) + try: + for a in chain(user.passing_addons, user.failing_addons): + try: + results = job.result_set.filter(file__version__addon=a) - a.links = ' '.join(absolutify(reverse('devhub.bulk_compat_result', + a.links = [absolutify(reverse('devhub.bulk_compat_result', args=[a.slug, r.pk])) - for r in results) + for r in results] - a.compat_link = absolutify(reverse('devhub.versions.edit', - args=[a.pk, - a.current_version.pk])) + v = a.current_version or a.latest_version + a.compat_link = absolutify(reverse('devhub.versions.edit', + args=[a.pk, v.pk])) + except: + task_error = sys.exc_info() + log.error(u'Bulk validation email error for user %s, ' + u'addon %s: %s: %s' + % (user.email, a.slug, + task_error[0], task_error[1]), exc_info=False) - context = Context({ - 'APPLICATION': str(job.application), - 'VERSION': job.target_version.version, - 'PASSING_ADDONS': user.passing_addons, - 'FAILING_ADDONS': user.failing_addons, - }) + context = Context({ + 'APPLICATION': str(job.application), + 'VERSION': job.target_version.version, + 'PASSING_ADDONS': user.passing_addons, + 'FAILING_ADDONS': user.failing_addons, + }) - log.info(u'Emailing %s%s for %d addons about ' - 'bulk validation job %s' - % (user.email, - ' [PREVIEW]' if dry_run else '', - len(user.passing_addons) + len(user.failing_addons), - job.pk)) - args = (Template(data['subject']).render(context), - Template(data['text']).render(context)) - kwargs = dict(from_email=settings.DEFAULT_FROM_EMAIL, - recipient_list=[user.email]) - if dry_run: - job.preview_notify_mail(*args, **kwargs) - else: - stats['author_emailed'] += 1 - send_mail(*args, **kwargs) - amo.log(amo.LOG.BULK_VALIDATION_USER_EMAILED, - user, - details={'passing': [a.id for a in user.passing_addons], - 'failing': [a.id for a in user.failing_addons], - 'target': job.target_version.version, - 'application': app_id}) + log.info(u'Emailing %s%s for %d addons about ' + 'bulk validation job %s' + % (user.email, + ' [PREVIEW]' if dry_run else '', + len(user.passing_addons) + len(user.failing_addons), + job.pk)) + args = (Template(data['subject']).render(context), + Template(data['text']).render(context)) + kwargs = dict(from_email=settings.DEFAULT_FROM_EMAIL, + recipient_list=[user.email]) + if dry_run: + job.preview_notify_mail(*args, **kwargs) + else: + stats['author_emailed'] += 1 + send_mail(*args, **kwargs) + amo.log(amo.LOG.BULK_VALIDATION_USER_EMAILED, + user, + details={'passing': [a.id for a in user.passing_addons], + 'failing': [a.id for a in user.failing_addons], + 'target': job.target_version.version, + 'application': app_id}) + except: + task_error = sys.exc_info() + log.error(u'Bulk validation email error for user %s: %s: %s' + % (user.email, + task_error[0], task_error[1]), exc_info=False) log.info('[%s@%s] bulk email stats for job %s: {%s}' % (len(users), notify_compatibility.rate_limit, job.pk, diff --git a/apps/zadmin/templates/zadmin/validation-email.txt b/apps/zadmin/templates/zadmin/validation-email.txt index 5eb03b5a2b..1553bd5c7e 100644 --- a/apps/zadmin/templates/zadmin/validation-email.txt +++ b/apps/zadmin/templates/zadmin/validation-email.txt @@ -1,6 +1,6 @@ -Dear add-on author, +{% autoescape off %}Dear add-on author, {% if PASSING_ADDONS and not FAILING_ADDONS %} -Good news! Our automated tests did not detect any compatibility issues with your add-on{{PASSING_ADDONS|length|pluralize}} and {{APPLICATION}} {{VERSION}}. We've updated your add-on{{PASSING_ADDONS|length|pluralize:"'s,s'"}} compatibility to work with {{APPLICATION}} {{VERSION}} so that our Aurora users can begin using your add-on{{PASSING_ADDONS|length|pluralize}}. +Good news! Our automated tests did not detect any compatibility issues with your add-on{{PASSING_ADDONS|length|pluralize}} and {{APPLICATION}} {{VERSION}}. We've updated your add-on{{PASSING_ADDONS|length|pluralize:"'s,s'"}} compatibility to work with {{APPLICATION}} {{VERSION}} so that our beta and release users can begin using your add-on{{PASSING_ADDONS|length|pluralize}}. We encourage you to view the results of the compatibility test, as some compatibility issues may have been detected but without enough certainty to declare the add-on incompatible: {% elif FAILING_ADDONS and not PASSING_ADDONS %} @@ -8,12 +8,13 @@ While testing add-ons for compatibility with the upcoming release of {{APPLICATI {% else %} While testing add-ons for compatibility with the upcoming release of {{APPLICATION}} {{VERSION}}, we detected some potential compatibility issues with your add-on{{FAILING_ADDONS|length|pluralize}}. -Our automated tests did not detect any compatibility issues with the following add-on{{PASSING_ADDONS|length|pluralize}} and {{APPLICATION}} {{VERSION}}. We've updated your add-on{{PASSING_ADDONS|length|pluralize:"'s,s'"}} compatibility to work with {{APPLICATION}} {{VERSION}} so that our Aurora users can begin using your add-on{{PASSING_ADDONS|length|pluralize}}. +Our automated tests did not detect any compatibility issues with the following add-on{{PASSING_ADDONS|length|pluralize}} and {{APPLICATION}} {{VERSION}}. We've updated your add-on{{PASSING_ADDONS|length|pluralize:"'s,s'"}} compatibility to work with {{APPLICATION}} {{VERSION}} so that our beta and release users can begin using your add-on{{PASSING_ADDONS|length|pluralize}}. {% endif %}{% comment %} {% endcomment %}{% if PASSING_ADDONS %} {% for addon in PASSING_ADDONS %} - • {{addon.name}}: {{addon.links}}{% endfor %} + • {{addon.name}}:{% for link in addon.links %} + ▶ {{link}}{% endfor %}{% endfor %} This compatibility bump is server-side and we did not modify your add-on package in any way. {% endif %}{% comment %} @@ -21,11 +22,13 @@ This compatibility bump is server-side and we did not modify your add-on package {% endcomment %}{% if FAILING_ADDONS %} Because of these potential problems, we were not able to automatically mark the following add-on{{FAILING_ADDONS|length|pluralize}} as compatible with {{APPLICATION}} {{VERSION}}. Please look into these issues and upload a new version if necessary. If you've tested your add-on{{FAILING_ADDONS|length|pluralize}} and no changes are required, you can update your compatibility to {{APPLICATION}} {{VERSION}} on the developer hub page{{FAILING_ADDONS|length|pluralize}} below. No future compatibility tests will be run on {{FAILING_ADDONS|length|pluralize:"this add-on,these add-ons"}} until their compatibility information has been updated to include the latest {{APPLICATION}} release. {% for addon in FAILING_ADDONS %} - • {{addon.name}}: {{addon.links}} {{addon.compat_link}}{% endfor %} + • {{addon.name}}:{% for link in addon.links %} + ▶ {{link}}{% endfor %} + ▶ {{addon.compat_link}}{% endfor %} {% endif %} Thank you, Firefox Add-ons team -- -You are receiving this email as a registered add-on author on addons.mozilla.org. If you no longer wish to receive these emails, please disable your add-on from the Developer Hub at https://addons.mozilla.org/developers +You are receiving this email as a registered add-on author on addons.mozilla.org. If you no longer wish to receive these emails, please disable your add-on from the Developer Hub at https://addons.mozilla.org/developers{% endautoescape %}