Catch exception on email reply processing. Issue #1
This commit is contained in:
parent
881c525ae9
commit
4ff344df75
1 changed files with 8 additions and 4 deletions
|
@ -119,13 +119,16 @@ def reply_comment_email(data):
|
||||||
break
|
break
|
||||||
|
|
||||||
m = re.search('\[(\d+)\:(\w+)\]', subject)
|
m = re.search('\[(\d+)\:(\w+)\]', subject)
|
||||||
|
if not m:
|
||||||
|
logger.warn('ignore corrupted email. No token %s' % subject)
|
||||||
|
return
|
||||||
comment_id = int(m.group(1))
|
comment_id = int(m.group(1))
|
||||||
token = m.group(2)
|
token = m.group(2)
|
||||||
|
|
||||||
# retrieve site and comment rows
|
# retrieve site and comment rows
|
||||||
comment = Comment.select().where(Comment.id == comment_id).get()
|
comment = Comment.select().where(Comment.id == comment_id).get()
|
||||||
if comment.site.token != token:
|
if comment.site.token != token:
|
||||||
logger.warn('ignore corrupted email')
|
logger.warn('ignore corrupted email. Unknown token %d' % comment_id)
|
||||||
return
|
return
|
||||||
|
|
||||||
if not message:
|
if not message:
|
||||||
|
@ -334,7 +337,7 @@ def report(token):
|
||||||
|
|
||||||
mail(site.admin_email, subject, email_body)
|
mail(site.admin_email, subject, email_body)
|
||||||
|
|
||||||
# delete report table
|
# delete report table
|
||||||
Report.delete().execute()
|
Report.delete().execute()
|
||||||
|
|
||||||
|
|
||||||
|
@ -345,11 +348,12 @@ def rss(token):
|
||||||
|
|
||||||
items = []
|
items = []
|
||||||
for row in Comment.select().join(Site).where(
|
for row in Comment.select().join(Site).where(
|
||||||
Site.token == token, Comment.published).order_by(-Comment.published).limit(10):
|
Site.token == token, Comment.published).order_by(
|
||||||
|
-Comment.published).limit(10):
|
||||||
item_link = "http://%s%s" % (site.url, row.url)
|
item_link = "http://%s%s" % (site.url, row.url)
|
||||||
items.append(PyRSS2Gen.RSSItem(
|
items.append(PyRSS2Gen.RSSItem(
|
||||||
title='%s - http://%s%s' % (row.author_name, site.url, row.url),
|
title='%s - http://%s%s' % (row.author_name, site.url, row.url),
|
||||||
link= item_link,
|
link=item_link,
|
||||||
description=md.convert(row.content),
|
description=md.convert(row.content),
|
||||||
guid=PyRSS2Gen.Guid(item_link),
|
guid=PyRSS2Gen.Guid(item_link),
|
||||||
pubDate=row.published
|
pubDate=row.published
|
||||||
|
|
Loading…
Add table
Reference in a new issue