summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-01-31 17:52:08 -0600
committerDan McGee <dan@archlinux.org>2010-01-31 17:52:08 -0600
commita16b4d9ecd2a3fa1676e8bc1d69de5e5d41d0d18 (patch)
treeb8e6d39d0513819c1d7fe4ff9eaf777de0ea5440 /packages
parenta32eb2dce6e19445492528f0b93bf3850389c41a (diff)
downloadarchweb-a16b4d9ecd2a3fa1676e8bc1d69de5e5d41d0d18.tar.gz
archweb-a16b4d9ecd2a3fa1676e8bc1d69de5e5d41d0d18.zip
Make marking out of date actually work
And honor the packager's notify flag, as Pierre pointed out. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages')
-rw-r--r--packages/views.py39
1 files changed, 22 insertions, 17 deletions
diff --git a/packages/views.py b/packages/views.py
index 28d458a0..a514617d 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -1,7 +1,8 @@
import urllib
from django import forms
+from django.core.mail import send_mail
from django.shortcuts import render_to_response
-from django.template import RequestContext
+from django.template import loader, Context, RequestContext
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.contrib.auth.models import User
@@ -250,6 +251,7 @@ def flag(request, pkgid):
if request.POST:
form = FlagForm(request.POST)
if form.is_valid() and form.cleaned_data['website'] == '':
+ send_email = True
# flag all architectures
pkgs = Package.objects.filter(
pkgname=pkg.pkgname, repo=pkg.repo)
@@ -260,23 +262,28 @@ def flag(request, pkgid):
if not pkg.maintainer:
toemail = 'arch-notifications@archlinux.org'
subject = 'Orphan %s package [%s] marked out-of-date' % (pkg.repo.name, pkg.pkgname)
- else:
+ elif pkg.maintainer.get_profile().notify == True:
toemail = pkg.maintainer.email
subject = '%s package [%s] marked out-of-date' % (pkg.repo.name, pkg.pkgname)
+ else:
+ # no need to send any email, packager didn't want notification
+ send_email = False
+
+ if send_email:
+ # send notification email to the maintainer
+ t = loader.get_template('packages/outofdate.txt')
+ c = Context({
+ 'email': form.cleaned_data['email'],
+ 'message': form.cleaned_data['usermessage'],
+ 'pkg': pkg,
+ 'weburl': 'http://www.archlinux.org'+ pkg.get_absolute_url()
+ })
+ send_mail(subject,
+ t.render(c),
+ 'Arch Website Notification <nobody@archlinux.org>',
+ [toemail],
+ fail_silently=True)
- # send notification email to the maintainer
- t = loader.get_template('packages/outofdate.txt')
- c = Context({
- 'email': form.cleaned_data['email'],
- 'message': form.cleaned_data['usermessage'],
- 'pkg': pkg,
- 'weburl': 'http://www.archlinux.org'+ pkg.get_absolute_url()
- })
- send_mail(subject,
- t.render(c),
- 'Arch Website Notification <nobody@archlinux.org>',
- [toemail],
- fail_silently=True)
context['confirmed'] = True
else:
form = FlagForm()
@@ -285,7 +292,5 @@ def flag(request, pkgid):
return render_to_response('packages/flag.html', context)
-
-
# vim: set ts=4 sw=4 et: