summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-05-24 15:09:51 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-05-24 15:09:51 -0400
commiteee3ec8b7d78a04f4b3f8a56c7f73797318c9dd0 (patch)
tree9a7d1a615ae585c221e9ea4fd061e58502dbe95f
parentc839624b845c98c3531ba5b582bbce5b24519cf2 (diff)
downloadaskbot-eee3ec8b7d78a04f4b3f8a56c7f73797318c9dd0.tar.gz
askbot-eee3ec8b7d78a04f4b3f8a56c7f73797318c9dd0.tar.bz2
askbot-eee3ec8b7d78a04f4b3f8a56c7f73797318c9dd0.zip
added signature stripping to posting of responses by email
-rw-r--r--askbot/models/__init__.py3
-rw-r--r--askbot/models/reply_by_email.py2
2 files changed, 5 insertions, 0 deletions
diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py
index 90336e6c..d7b838d5 100644
--- a/askbot/models/__init__.py
+++ b/askbot/models/__init__.py
@@ -207,6 +207,9 @@ def user_update_avatar_type(self):
def user_strip_email_signature(self, text):
"""strips email signature from the end of the text"""
+ if self.email_signature == '':
+ return text
+
text = '\n'.join(text.splitlines())#normalize the line endings
if text.endswith(self.email_signature):
return text[0:-len(self.email_signature)]
diff --git a/askbot/models/reply_by_email.py b/askbot/models/reply_by_email.py
index 4398f693..786b38a5 100644
--- a/askbot/models/reply_by_email.py
+++ b/askbot/models/reply_by_email.py
@@ -79,6 +79,7 @@ class ReplyAddress(models.Model):
to the same address"""
assert self.was_used == True
content, stored_files = mail.process_parts(parts)
+ content = self.user.strip_email_signature(content)
self.user.edit_post(
post = self.response_post,
body_text = content,
@@ -94,6 +95,7 @@ class ReplyAddress(models.Model):
result = None
#todo: delete stored files if this function fails
content, stored_files = mail.process_parts(parts)
+ content = self.user.strip_email_signature(content)
if self.post.post_type == 'answer':
result = self.user.post_comment(