Logo Search packages:      
Sourcecode: zope-backtalk version File versions

def BackTalk::BackTalk::BackTalkDocument::addComment (   self,

Add a comment to the paragraph that is referenced by the
record 'paragraph' 

Definition at line 766 of file BackTalk.py.

00766                                             :
        """ Add a comment to the paragraph that is referenced by the
        record 'paragraph' """
        index = paragraph.index
        level = paragraph.level
        comment = string.strip(comment)
        if not comment and hasattr(self, 'REQUEST'):
            self.REQUEST.RESPONSE.redirect(self.absolute_url() +
                                           '#%s-%s' % (level, index))
            return ''
        st = BackTalkBase.BasicWithIds(self.read_raw()) # this should be cached
        username = getSecurityManager().getUser().getUserName() or ''
        date = DateTime().pCommon()
        BackTalkBase.insertComment(st, comment, username, date, level, index)
        # calls "self.cook" and sets self.raw
        # we dont recatalog on a comment (this is on purpose)
        parent = self.getParentBook()
        if self.comment_email_addresses or parent:
            graph = BackTalkBase.getParagraphGraph(st)
            indexes = graph[level]
            paragraph = indexes[index]
            paragraph = BackTalkBase.flatten_basic(paragraph)
            url = self.absolute_url() + '#%s-%s' % (level, index)
            paragraph = (
                'A comment to the paragraph below was recently added '
                'via %s\n\n---------------\n\n%s' % (url, paragraph)
        if hasattr(self, 'REQUEST'):
            self.REQUEST.RESPONSE.redirect(self.absolute_url() +
                                           '#%s-%s' % (level, index))

    security.declareProtected(VIEW, 'getRenderedParagraph')
    def getRenderedParagraph(self, level, index):

Generated by  Doxygen 1.6.0   Back to index