def edit_post(self, content, attachments = None):
     """edits the created post upon repeated response
     to the same address"""
     assert self.was_used == True
     content += mail.process_attachments(attachments)
     self.user.edit_post(
         post = self.response_post,
         body_text = content,
         revision_comment = _('edited by email')
     )
     self.response_post.thread.invalidate_cached_data()
    def create_reply(self, content, attachments = None):
        """creates a reply to the post which was emailed
        to the user
        """
        result = None
        content += mail.process_attachments(attachments)

        if self.post.post_type == 'answer':
            result = self.user.post_comment(self.post, content)
        elif self.post.post_type == 'question':
            wordcount = len(content)/6#this is a simplistic hack
            if wordcount > askbot_settings.MIN_WORDS_FOR_ANSWER_BY_EMAIL:
                result = self.user.post_answer(self.post, content)
            else:
                result = self.user.post_comment(self.post, content)
        elif self.post.post_type == 'comment':
            result = self.user.post_comment(self.post.parent, content)
        result.thread.invalidate_cached_data()
        self.response_post = result
        self.used_at = datetime.now()
        self.save()
        return result