Changeset 343 for trunk


Ignore:
Timestamp:
03/24/10 15:53:38 (14 years ago)
Author:
bas
Message:

Re-arranged functions per section

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/email2trac.py.in

    r342 r343  
    953953                        changed = True
    954954                        comment = u'\nadded mailto line\n'
    955                         mailto = self.html_mailto_link( m['Subject'], body_text)
     955                        mailto = self.html_mailto_link( m['Subject'])
    956956
    957957                        tkt['description'] = u'%s\r\n%s%s\r\n' \
     
    12091209                        self.new_ticket(m, subject, spam_msg)
    12101210
     1211########## BODY TEXT functions  ###########################################################
     1212
    12111213        def strip_signature(self, text):
    12121214                """
     
    13191321                #
    13201322
     1323########## EMAIL attachements functions ###########################################################
     1324
    13211325        def inline_part(self, part):
    13221326                """
     
    15321536                except attachment.ResourceNotFound:
    15331537                        return False
     1538
     1539########## TRAC Ticket Text ###########################################################
    15341540                       
    15351541        def body_text(self, message_parts):
     
    15561562                return body_text
    15571563
     1564        def html_mailto_link(self, subject):
     1565                """
     1566                This function returns a HTML mailto tag with the ticket id and author email address
     1567                """
     1568                if not self.author:
     1569                        author = self.email_addr
     1570                else:   
     1571                        author = self.author
     1572
     1573                # use urllib to escape the chars
     1574                #
     1575                s = 'mailto:%s?Subject=%s&Cc=%s' %(
     1576                       urllib.quote(self.email_addr),
     1577                           urllib.quote('Re: #%s: %s' %(self.id, subject)),
     1578                           urllib.quote(self.MAILTO_CC)
     1579                           )
     1580
     1581                s = '\r\n{{{\r\n#!html\r\n<a\r\n href="%s">Reply to: %s\r\n</a>\r\n}}}\r\n' %(s, author)
     1582                return s
     1583
     1584########## TRAC notify section ###########################################################
     1585
    15581586        def notify(self, tkt, new=True, modtime=0):
    15591587                """
     
    15941622                        print 'TD: Failure sending notification on creation of ticket #%s: %s' %(self.id, e)
    15951623
    1596         def html_mailto_link(self, subject, body):
    1597                 """
    1598                 This function returns a HTML mailto tag with the ticket id and author email address
    1599                 """
    1600                 if not self.author:
    1601                         author = self.email_addr
    1602                 else:   
    1603                         author = self.author
    1604 
    1605                 # use urllib to escape the chars
    1606                 #
    1607                 s = 'mailto:%s?Subject=%s&Cc=%s' %(
    1608                        urllib.quote(self.email_addr),
    1609                            urllib.quote('Re: #%s: %s' %(self.id, subject)),
    1610                            urllib.quote(self.MAILTO_CC)
    1611                            )
    1612 
    1613                 s = '\r\n{{{\r\n#!html\r\n<a\r\n href="%s">Reply to: %s\r\n</a>\r\n}}}\r\n' %(s, author)
    1614                 return s
    1615 
     1624
     1625
     1626########## Parse Config File  ###########################################################
    16161627
    16171628def ReadConfig(file, name):
Note: See TracChangeset for help on using the changeset viewer.