Permalink
Browse files

removed the same error checking part

  • Loading branch information...
1 parent 3f5580a commit 558916d9fad627b7b8fae3e0ab4f799f51c23ad9 Bo Zhu committed Apr 11, 2012
Showing with 23 additions and 22 deletions.
  1. +23 −22 report.py
View
@@ -24,41 +24,42 @@
from google.appengine.api import mail
from credentials import ADMIN_EMAIL, ERROR_HANDLING_EMAIL
-from google.appengine.ext import db
+# from google.appengine.ext import db
import datetime
import logging
-class ErrorRecord(db.Model):
- title = db.StringProperty()
- detail = db.StringProperty(multiline=True)
- time = db.DateTimeProperty(auto_now=True)
+# class ErrorRecord(db.Model):
+# title = db.StringProperty()
+# detail = db.StringProperty(multiline=True)
+# time = db.DateTimeProperty(auto_now=True)
-def save_last_error(title, detail):
- error_db = ErrorRecord(key_name='last_error')
- error_db.title = title
- error_db.detail = detail
- error_db.put()
+# def save_last_error(title, detail):
+# error_db = ErrorRecord(key_name='last_error')
+# error_db.title = title
+# error_db.detail = detail
+# error_db.put()
-def check_last_error(title, detail):
- last_error_key = db.Key.from_path('ErrorRecord', 'last_error')
- last_error = db.get(last_error_key)
+# def check_last_error(title, detail):
+# last_error_key = db.Key.from_path('ErrorRecord', 'last_error')
+# last_error = db.get(last_error_key)
- if last_error:
- if title == last_error.title and detail == last_error.detail:
- diff_time = datetime.datetime.now() - last_error.time
- if diff_time.days == 0 and diff_time.seconds < 3600:
- # won't send duplicated emails in an hour
- return False
+# if last_error:
+# if title == last_error.title and detail == last_error.detail:
+# diff_time = datetime.datetime.now() - last_error.time
+# if diff_time.days == 0 and diff_time.seconds < 3600:
+# # won't send duplicated emails in an hour
+# return False
- save_last_error(title, detail)
- return True
+# save_last_error(title, detail)
+# return True
def report_error(title, detail):
logging.error(title + '\n' + detail)
- if check_last_error(title, detail):
+# if check_last_error(title, detail):
+ if True: # changed cron to once 4 hrs, so do not need this anymore
mail.send_mail(ADMIN_EMAIL, ERROR_HANDLING_EMAIL,
title, detail + '\n\n' + datetime.datetime.now().ctime())

0 comments on commit 558916d

Please sign in to comment.