mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
No longer sending tons of mail to admins. Logging is where that goes.
This commit is contained in:
parent
5ed760574d
commit
06c25df199
3 changed files with 7 additions and 11 deletions
|
@ -25,7 +25,6 @@ from django.contrib.auth import logout as logout_user
|
|||
from django.contrib.auth.models import User
|
||||
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden, Http404, UnreadablePostError
|
||||
from django.conf import settings
|
||||
from django.core.mail import mail_admins
|
||||
from django.core.mail import EmailMultiAlternatives
|
||||
from django.core.validators import validate_email
|
||||
from django.contrib.sites.models import Site
|
||||
|
@ -2494,9 +2493,7 @@ def activate_premium_account(request):
|
|||
sub.feed.count_subscribers()
|
||||
sub.feed.schedule_feed_fetch_immediately()
|
||||
except Exception as e:
|
||||
subject = "Premium activation failed"
|
||||
message = "%s -- %s\n\n%s" % (request.user, usersubs, e)
|
||||
mail_admins(subject, message, fail_silently=True)
|
||||
logging.user(request, "~BR~FWPremium activation failed: {e} {usersubs}")
|
||||
|
||||
request.user.profile.is_premium = True
|
||||
request.user.profile.save()
|
||||
|
|
|
@ -7,7 +7,6 @@ import urllib.request, urllib.parse, urllib.error
|
|||
import urllib.parse
|
||||
import random
|
||||
import warnings
|
||||
from django.core.mail import mail_admins
|
||||
from django.utils.translation import ungettext
|
||||
from django.utils.encoding import smart_str
|
||||
from utils import log as logging
|
||||
|
@ -41,8 +40,8 @@ def timelimit(timeout):
|
|||
raise TimeoutError('took too long')
|
||||
if c.error:
|
||||
tb = ''.join(traceback.format_exception(c.exc_info[0], c.exc_info[1], c.exc_info[2]))
|
||||
logging.debug(tb)
|
||||
mail_admins('Error in timeout: %s' % c.exc_info[0], tb)
|
||||
logging.debug(f" ***> Traceback timeout error: {tb}")
|
||||
# mail_admins('Error in timeout: %s' % c.exc_info[0], tb)
|
||||
raise c.error
|
||||
return c.result
|
||||
return _2
|
||||
|
@ -221,8 +220,7 @@ def mail_feed_error_to_admin(feed, e, local_vars=None, subject=None):
|
|||
pprint.pformat(feed.__dict__),
|
||||
pprint.pformat(local_vars)
|
||||
)
|
||||
# print message
|
||||
mail_admins(subject, message)
|
||||
logging.debug(f" ***> Feed error, {subject}: {message}")
|
||||
|
||||
## {{{ http://code.activestate.com/recipes/576611/ (r11)
|
||||
from operator import itemgetter
|
||||
|
|
|
@ -7,11 +7,11 @@ from decimal import Decimal
|
|||
from django.core import serializers
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponse, HttpResponseForbidden, Http404
|
||||
from django.core.mail import mail_admins
|
||||
from django.db.models.query import QuerySet
|
||||
# from django.utils.deprecation import CallableBool
|
||||
from mongoengine.queryset.queryset import QuerySet as MongoQuerySet
|
||||
from bson.objectid import ObjectId
|
||||
from utils import log as logging
|
||||
import sys
|
||||
import datetime
|
||||
|
||||
|
@ -161,7 +161,8 @@ def json_response(request, response=None):
|
|||
'text': str(e)}
|
||||
code = 500
|
||||
if not settings.DEBUG:
|
||||
mail_admins(subject, message, fail_silently=True)
|
||||
logging.debug(f" ***> JSON exception {subject}: {message}")
|
||||
logging.debug('\n'.join(traceback.format_exception(*exc_info)))
|
||||
else:
|
||||
print('\n'.join(traceback.format_exception(*exc_info)))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue