Changeset 288


Ignore:
Timestamp:
10/22/09 18:02:24 (14 years ago)
Author:
bas
Message:

email2trac.py.in:

  • workflow patch, did not work, closes #157
  • When i ticket is updated we did supply all need fields, like ticket change number, closes #156

debian/changelog:

  • new list of changes
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/debian/changelog

    r283 r288  
     1email2trac (1.1.0-1) stable; urgency=low
     2
     3  * Workflow option did not work, closes #157
     4    Reported by: thomas dot moschny at gmx dot de
     5    Fixed  by: Bas van der Vlies & Thomas Moschny
     6   
     7  * When a ticket is updated via email. We must set a changelog id,
     8    closes #156
     9    Reported by: Chris dot Nelson at SIXNET dot com
     10    Fixed by: Bas van der Vlies
     11
     12 * Changed all 'str =' assignments to 's =' to solve conflicts with
     13   the builtin str function
     14    Fixed by: Bas van der Vlies
     15
     16 -- Bas van der Vlies <bas@sara.nl>  Thu, 22 Oct 2009 17:47:50 +0200
     17
    118email2trac (1.0.0-1) stable; urgency=low
    219
  • trunk/email2trac.py.in

    r287 r288  
    130130                self.email_addr = None
    131131                self.email_from = None
    132                 self.author     = Nome
     132                self.author     = None
    133133                self.id         = None
    134134
     
    344344                """
    345345                results =  email.Header.decode_header(message_str)
    346                 str = None
     346                s = None
    347347                for text,format in results:
    348348                        if format:
     
    362362                                temp = unicode(text, 'iso-8859-15')
    363363
    364                         if str:
    365                                 str = '%s %s' %(str, temp)
     364                        if s:
     365                                s = '%s %s' %(s, temp)
    366366                        else:
    367                                 str = '%s' %temp
    368 
    369                 #str = str.encode('utf-8')
    370                 return str
     367                                s = '%s' %temp
     368
     369                #s = s.encode('utf-8')
     370                return s
    371371
    372372        def debug_body(self, message_body, tempfile=False):
     
    423423                Display To and CC addresses in description field
    424424                """
    425                 str = ''
     425                s = ''
    426426                #if m['To'] and len(m['To']) > 0 and m['To'] != 'hic@sara.nl':
    427427                if m['To'] and len(m['To']) > 0:
    428                         str = "'''To:''' %s\r\n" %(m['To'])
     428                        s = "'''To:''' %s\r\n" %(m['To'])
    429429                if m['Cc'] and len(m['Cc']) > 0:
    430                         str = "%s'''Cc:''' %s\r\n" % (str, m['Cc'])
    431 
    432                 return  self.email_to_unicode(str)
     430                        s = "%s'''Cc:''' %s\r\n" % (s, m['Cc'])
     431
     432                return  self.email_to_unicode(s)
    433433
    434434
     
    519519                        pass
    520520
    521         def str_to_dict(self, str):
    522                 """
    523                 Transfrom a str of the form [<key>=<value>]+ to dict[<key>] = <value>
     521        def str_to_dict(self, s):
     522                """
     523                Transfrom a string of the form [<key>=<value>]+ to dict[<key>] = <value>
    524524                """
    525525
    526                 fields = string.split(str, ',')
     526                fields = string.split(s, ',')
    527527
    528528                result = dict()
     
    643643                        return False
    644644
     645                # How many changes has this ticket
     646                cnum = len(tkt.get_changelog())
     647
     648
    645649                # reopen the ticket if it is was closed
    646650                # We must use the ticket workflow framework
     
    662666                        #print 'get_ticket_changes :', b
    663667
    664                         if self.WORKFLOW and (self.VERSION in ['0.11']) :
     668                        if self.WORKFLOW and (self.VERSION in [0.11]) :
    665669                                from trac.ticket.default_workflow import ConfigurableTicketWorkflow
    666670                                from trac.test import Mock, MockPerm
     
    696700                if body_text.strip() or update_fields:
    697701                        if self.DRY_RUN:
    698                                 print 'DRY_RUN: tkt.save_changes(self.author, comment) ', self.author
     702                                print 'DRY_RUN: tkt.save_changes(self.author, body_text, ticket_change_number) ', self.author, cnum
    699703                        else:
    700                                 tkt.save_changes(self.author, body_text, when)
     704                                #tkt.save_changes(self.author, body_text, when)
     705                                tkt.save_changes(self.author, body_text, when, None, str(cnum))
     706                                a =1
     707                       
    701708
    702709                if self.VERSION  == 0.9:
    703                         str = self.attachments(message_parts, True)
    704                 else:
    705                         str = self.attachments(message_parts)
     710                        s = self.attachments(message_parts, True)
     711                else:
     712                        s = self.attachments(message_parts)
    706713
    707714                if self.notification and not spam:
     
    838845                                %(head, mailto, body_text)
    839846
    840                 str =  self.attachments(message_parts)
    841                 if str:
     847                has_attachments =  self.attachments(message_parts)
     848                if has_attachments:
    842849                        changed = True
    843                         comment = '%s\n%s\n' %(comment, str)
     850                        comment = '%s\n%s\n' %(comment, has_attachments)
    844851
    845852                if changed:
     
    13761383                # use urllib to escape the chars
    13771384                #
    1378                 str = 'mailto:%s?Subject=%s&Cc=%s' %(
     1385                s = 'mailto:%s?Subject=%s&Cc=%s' %(
    13791386                       urllib.quote(self.email_addr),
    13801387                           urllib.quote('Re: #%s: %s' %(self.id, subject)),
     
    13821389                           )
    13831390
    1384                 str = '\r\n{{{\r\n#!html\r\n<a\r\n href="%s">Reply to: %s\r\n</a>\r\n}}}\r\n' %(str, author)
    1385                 return str
     1391                s = '\r\n{{{\r\n#!html\r\n<a\r\n href="%s">Reply to: %s\r\n</a>\r\n}}}\r\n' %(str, author)
     1392                return s
    13861393
    13871394        def attachments(self, message_parts, update=False):
Note: See TracChangeset for help on using the changeset viewer.