From a529bba0262296c3057ada4f364616509f96af65 Mon Sep 17 00:00:00 2001 From: jordan Date: Sat, 23 Apr 2011 17:41:34 +0000 Subject: [PATCH] send the administrator emails git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@999 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum_modules/updater/base.py | 10 +++++++++- forum_modules/updater/views.py | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/forum_modules/updater/base.py b/forum_modules/updater/base.py index 995c70c..7635b60 100644 --- a/forum_modules/updater/base.py +++ b/forum_modules/updater/base.py @@ -4,7 +4,7 @@ import re import urllib2 -from forum.models import Question +from forum.models import Question, User from forum.settings import APP_URL def generate_installation_key(): @@ -38,3 +38,11 @@ def get_server_name(): return server_name except: return 'Unknown' + +def get_admin_emails(): + emails = [] + + for user in User.objects.filter(is_superuser=True): + emails.append(user.email) + + return emails \ No newline at end of file diff --git a/forum_modules/updater/views.py b/forum_modules/updater/views.py index 5d68e57..083819f 100644 --- a/forum_modules/updater/views.py +++ b/forum_modules/updater/views.py @@ -12,7 +12,7 @@ from django.utils.translation import ugettext as _ from django.utils import simplejson from django.conf import settings -from base import get_site_views, get_server_name +from base import get_site_views, get_server_name, get_admin_emails from settings import SITE_KEY, UPDATE_SERVER_URL from forum.settings import APP_URL, SVN_REVISION from forum.views.admin import admin_tools_page, admin_page @@ -34,6 +34,11 @@ def updater_check(request): # Here we'll have to find another way of getting the SVN revision svn_revision = 0 + admin_emails_xml = '' + for email in get_admin_emails(): + admin_emails_xml += '' % email + admin_emails_xml += '' + statistics = """ @@ -45,6 +50,7 @@ def updater_check(request): + %(emails)s """ % { 'site_key' : SITE_KEY, 'app_url' : APP_URL, @@ -55,6 +61,7 @@ def updater_check(request): 'django_version' : str(DJANGO_VERSION), 'database' : settings.DATABASE_ENGINE, 'os' : str(os.uname()), + 'emails' : admin_emails_xml, } # Compress the statistics XML dump -- 2.39.5