Mercurial > public > sg101
comparison gpp/core/functions.py @ 37:91fd31dc78fb
Removed the database logging stuff. Will replace with Python logging.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 11 Jun 2009 01:00:31 +0000 |
parents | b3b11edf91d8 |
children | c14cfd6be87a |
comparison
equal
deleted
inserted
replaced
36:296b610ee507 | 37:91fd31dc78fb |
---|---|
1 """This file houses various core utility functions for GPP""" | 1 """This file houses various core utility functions for GPP""" |
2 | 2 |
3 import django.core.mail | 3 import django.core.mail |
4 from django.contrib.sites.models import Site | 4 from django.contrib.sites.models import Site |
5 from django.conf import settings | 5 from django.conf import settings |
6 | |
7 from core import logging | |
8 | 6 |
9 | 7 |
10 def send_mail(subject, message, from_email, recipient_list, | 8 def send_mail(subject, message, from_email, recipient_list, |
11 fail_silently = False, auth_user = None, auth_password = None): | 9 fail_silently = False, auth_user = None, auth_password = None): |
12 """The main gpp send email function. | 10 """The main gpp send email function. |
16 | 14 |
17 if settings.GPP_SEND_EMAIL: | 15 if settings.GPP_SEND_EMAIL: |
18 django.core.mail.send_mail(subject, message, from_email, recipient_list, | 16 django.core.mail.send_mail(subject, message, from_email, recipient_list, |
19 fail_silently, auth_user, auth_password) | 17 fail_silently, auth_user, auth_password) |
20 | 18 |
21 logging.info('EMAIL:\nFrom: %s\nTo: %s\nSubject: %s\nMessage:\n%s' % | 19 #logging.info('EMAIL:\nFrom: %s\nTo: %s\nSubject: %s\nMessage:\n%s' % |
22 (from_email, str(recipient_list), subject, message)) | 20 # (from_email, str(recipient_list), subject, message)) |
23 | 21 |
24 | 22 |
25 def email_admins(subject, message): | 23 def email_admins(subject, message): |
26 """Emails the site admins. Goes through the site send_mail function.""" | 24 """Emails the site admins. Goes through the site send_mail function.""" |
27 site = Site.objects.get_current() | 25 site = Site.objects.get_current() |
48 full_name = user.get_full_name() | 46 full_name = user.get_full_name() |
49 if full_name: | 47 if full_name: |
50 return full_name | 48 return full_name |
51 return user.username | 49 return user.username |
52 | 50 |
53 # vim: ts=4 sw=4 |