Example #1
0
    def testPostComment(self):
        s = '''
[email protected] wrote:
> blah blah blah blahblah blahblah blahblah blah blah blah blah blah
> blah
> blah blah blah blah blah blah blah blah blah?  blah blah blah blah
> blah
> blah blah blah blah blah blah blah...  blah blah blah blah.  blah
> blah
> blah blah blah blah?  blah blah blah blah blah blah!  blah blah!
>
> -------
> nosy: userfoo, userken
> _________________________________________________
> Roundup issue tracker
> [email protected]
> http://foo.com/cgi-bin/roundup.cgi/issue_tracker/

blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah
blah blah blah blah blah blah blah blah blah blah blah!

--
blah blah blah signature
[email protected]
'''
        summary, content = parseContent(s, 0, 0)
        self.assertEqual(summary, 'blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah')
        self.assertEqual(content, 'blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah\nblah blah blah blah blah blah blah blah blah blah blah!')
Example #2
0
    def testKeepMultipleHyphens(self):
        body = '''Testing, testing.

----
Testing, testing.'''
        summary, content = parseContent(body, 1, 0)
        self.assertEqual(body, content)
Example #3
0
    def testKeepMultipleHyphens(self):
        body = '''Testing, testing.

----
Testing, testing.'''
        summary, content = parseContent(body, 1, 0)
        self.assertEqual(body, content)
Example #4
0
    def testPostComment(self):
        s = '''
[email protected] wrote:
> blah blah blah blahblah blahblah blahblah blah blah blah blah blah
> blah
> blah blah blah blah blah blah blah blah blah?  blah blah blah blah
> blah
> blah blah blah blah blah blah blah...  blah blah blah blah.  blah
> blah
> blah blah blah blah?  blah blah blah blah blah blah!  blah blah!
>
> -------
> nosy: userfoo, userken
> _________________________________________________
> Roundup issue tracker
> [email protected]
> http://foo.com/cgi-bin/roundup.cgi/issue_tracker/

blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah
blah blah blah blah blah blah blah blah blah blah blah!

--
blah blah blah signature
[email protected]
'''
        summary, content = parseContent(s, 0, 0)
        self.assertEqual(
            summary,
            'blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah'
        )
        self.assertEqual(
            content,
            'blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah\nblah blah blah blah blah blah blah blah blah blah blah!'
        )
Example #5
0
def summarygenerator(db, cl, nodeid, newvalues):
    """ If the message doesn't have a summary, make one for it.
    """
    if newvalues.has_key("summary") or not newvalues.has_key("content"):
        return

    summary, content = parseContent(newvalues["content"], config=db.config)
    newvalues["summary"] = summary
Example #6
0
def summarygenerator(db, cl, nodeid, newvalues):
    ''' If the message doesn't have a summary, make one for it.
    '''
    if 'summary' in newvalues or 'content' not in newvalues:
        return

    summary, content = parseContent(newvalues['content'], config=db.config)
    newvalues['summary'] = summary
Example #7
0
def summarygenerator(db, cl, nodeid, newvalues):
    ''' If the message doesn't have a summary, make one for it.
    '''
    if newvalues.has_key('summary') or not newvalues.has_key('content'):
        return

    summary, content = parseContent(newvalues['content'], config=db.config)
    newvalues['summary'] = summary
Example #8
0
def summarygenerator(db, cl, nodeid, newvalues):
    ''' If the message doesn't have a summary, make one for it.
    '''
    if newvalues.has_key('summary') or not newvalues.has_key('content'):
        return

    summary, content = parseContent(newvalues['content'], 1, 1)
    newvalues['summary'] = summary
Example #9
0
    def testKeepCitation(self):
        s = '''
blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah
blah blah blah blah blah blah blah blah blah blah blah!

[email protected] wrote:
> blah blah blah blahblah blahblah blahblah blah blah blah blah blah blah
> blah blah blah blah blah blah blah blah blah?  blah blah blah blah blah
> blah blah blah blah blah blah blah...  blah blah blah blah.  blah blah
> blah blah blah blah?  blah blah blah blah blah blah!  blah blah!
>
> -------
> nosy: userfoo, userken
> _________________________________________________
> Roundup issue tracker
> [email protected]
> http://foo.com/cgi-bin/roundup.cgi/issue_tracker/

--
blah blah blah signature
[email protected]
'''
        summary, content = parseContent(s, 1, 0)
        self.assertEqual(
            summary,
            'blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah'
        )
        self.assertEqual(
            content, '''\
blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah
blah blah blah blah blah blah blah blah blah blah blah!

[email protected] wrote:
> blah blah blah blahblah blahblah blahblah blah blah blah blah blah blah
> blah blah blah blah blah blah blah blah blah?  blah blah blah blah blah
> blah blah blah blah blah blah blah...  blah blah blah blah.  blah blah
> blah blah blah blah?  blah blah blah blah blah blah!  blah blah!
>
> -------
> nosy: userfoo, userken
> _________________________________________________
> Roundup issue tracker
> [email protected]
> http://foo.com/cgi-bin/roundup.cgi/issue_tracker/''')
Example #10
0
    def testKeepCitation(self):
        s = '''
blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah
blah blah blah blah blah blah blah blah blah blah blah!

[email protected] wrote:
> blah blah blah blahblah blahblah blahblah blah blah blah blah blah blah
> blah blah blah blah blah blah blah blah blah?  blah blah blah blah blah
> blah blah blah blah blah blah blah...  blah blah blah blah.  blah blah
> blah blah blah blah?  blah blah blah blah blah blah!  blah blah!
>
> -------
> nosy: userfoo, userken
> _________________________________________________
> Roundup issue tracker
> [email protected]
> http://foo.com/cgi-bin/roundup.cgi/issue_tracker/

--
blah blah blah signature
[email protected]
'''
        summary, content = parseContent(s, 1, 0)
        self.assertEqual(summary, 'blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah')
        self.assertEqual(content, '''\
blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah
blah blah blah blah blah blah blah blah blah blah blah!

[email protected] wrote:
> blah blah blah blahblah blahblah blahblah blah blah blah blah blah blah
> blah blah blah blah blah blah blah blah blah?  blah blah blah blah blah
> blah blah blah blah blah blah blah...  blah blah blah blah.  blah blah
> blah blah blah blah?  blah blah blah blah blah blah!  blah blah!
>
> -------
> nosy: userfoo, userken
> _________________________________________________
> Roundup issue tracker
> [email protected]
> http://foo.com/cgi-bin/roundup.cgi/issue_tracker/''')
Example #11
0
 def testSimple(self):
     s = '''testing'''
     summary, content = parseContent(s, 0, 0)
     self.assertEqual(summary, 'testing')
     self.assertEqual(content, 'testing')
Example #12
0
 def testMultilineSummary(self):
     s = 'This is a long sentence that would normally\nbe split. More words.'
     summary, content = parseContent(s, 0, 0)
     self.assertEqual(
         summary, 'This is a long sentence that would '
         'normally\nbe split.')
Example #13
0
 def testIndentationContent(self):
     s = '    Four space indent.\n\n    Four space indent.\nNo indent.'
     summary, content = parseContent(s, 0, 0)
     self.assertEqual(content, s)
Example #14
0
 def testEmpty(self):
     s = ''
     summary, content = parseContent(s, 0, 0)
     self.assertEqual(summary, '')
     self.assertEqual(content, '')
Example #15
0
 def testSimpleFollowupParas(self):
     s = '''>hello\ntesting\n\ntesting\n\ntesting'''
     summary, content = parseContent(s, 0, 0)
     self.assertEqual(summary, 'testing')
     self.assertEqual(content, 'testing\n\ntesting\n\ntesting')
Example #16
0
 def testParagraphs(self):
     s = '''testing\n\ntesting\n\ntesting'''
     summary, content = parseContent(s, 0, 0)
     self.assertEqual(summary, 'testing')
     self.assertEqual(content, 'testing\n\ntesting\n\ntesting')
Example #17
0
 def testSimple(self):
     s = '''testing'''
     summary, content = parseContent(s, 0, 0)
     self.assertEqual(summary, 'testing')
     self.assertEqual(content, 'testing')
Example #18
0
 def testIndentationContent(self):
     s = '    Four space indent.\n\n    Four space indent.\nNo indent.'
     summary, content = parseContent(s, 0, 0)
     self.assertEqual(content, s)
Example #19
0
 def testAllQuoted(self):
     s = '\[email protected] wrote:\n> testing\n'
     summary, content = parseContent(s, 0, 1)
     self.assertEqual(summary, '')
     self.assertEqual(content, s)
Example #20
0
 def testMultilineSummary(self):
     s = 'This is a long sentence that would normally\nbe split. More words.'
     summary, content = parseContent(s, 0, 0)
     self.assertEqual(summary, 'This is a long sentence that would '
         'normally\nbe split.')
Example #21
0
def audit_message(db, c, nodeid, newvalues):
    if newvalues.has_key('summary') or not newvalues.has_key('content'):
        return
    summary, _content = parseContent(newvalues['content'], 1, 1)
    newvalues['summary'] = summary
Example #22
0
 def testParagraphs(self):
     s = '''testing\n\ntesting\n\ntesting'''
     summary, content = parseContent(s, 0, 0)
     self.assertEqual(summary, 'testing')
     self.assertEqual(content, 'testing\n\ntesting\n\ntesting')
Example #23
0
 def testSimpleFollowupParas(self):
     s = '''>hello\ntesting\n\ntesting\n\ntesting'''
     summary, content = parseContent(s, 0, 0)
     self.assertEqual(summary, 'testing')
     self.assertEqual(content, 'testing\n\ntesting\n\ntesting')
Example #24
0
 def testAllQuoted(self):
     s = '\[email protected] wrote:\n> testing\n'
     summary, content = parseContent(s, 0, 1)
     self.assertEqual(summary, '')
     self.assertEqual(content, s)
Example #25
0
 def testEmpty(self):
     s = ''
     summary, content = parseContent(s, 0, 0)
     self.assertEqual(summary, '')
     self.assertEqual(content, '')