Ignore:
Timestamp:
05/19/06 10:53:47 (18 years ago)
Author:
bas
Message:

EmailtoTracScript?:

email2trac.py.in:

  • Starting with merging of tickets when a user replies via email

Makefile.in

  • replace all install commands with short options, compatible with MacOSX
File:
1 edited

Legend:

Unmodified
Added
Removed
  • emailtotracscript/trunk/email2trac.py.in

    r68 r71  
    303303                        pass
    304304
     305        def ticket_update(self, m):
     306
     307                if not m['Subject']:
     308                        return False
     309                else:
     310                        subject  = self.to_unicode(m['Subject'])
     311                print subject
     312
     313                TICKET_RE = re.compile(r"""
     314                                        (?P<ticketnr>[#][0-9]+:)
     315                                        """, re.VERBOSE)
     316
     317                result =  TICKET_RE.search(subject)
     318                if not result:
     319                        return False
     320
     321                # Strip # and : frim ticket_id
     322                ticket_id = result.group('ticketnr')
     323                ticket_id = int(ticket_id[1:-1])
     324                print ticket_id
     325
     326                tkt = Ticket(self.db, ticket_id)
     327                print tkt
     328                return True
     329
     330
    305331        def parse(self, fp):
    306332                msg = email.message_from_file(fp)
     
    312338
    313339                self.db = self.env.get_db_cnx()
     340                if self.ticket_update(msg):
     341                        print 'Ticket has been updated now new one'
     342                        sys.exit(0)
     343                else:
     344                        print 'New ticket'
     345
     346                sys.exit(0)
     347               
    314348                tkt = Ticket(self.env)
    315349                tkt['status'] = 'new'
     
    359393                        self.debug_attachments(msg)
    360394
    361                 self.description(msg,tkt, head, author, email_addr)
     395                self.description(msg, tkt, head, author, email_addr)
    362396
    363397                # Insert ticket in database
     
    371405                # Just how to show to update description
    372406                #
    373                 #tkt['description'] = '\n{{{\n\n Bas is op nieuw bezig\n\n }}}\n'
    374                 #tkt.save_changes(self.db, author, "Lekker bezig")
    375                 #
     407                #tkt['summary'] = '#%s: %s' %(tkt['id'], tkt['summary'])
     408                #tkt.save_changes(self.db, author, "")
    376409
    377410                self.attachments(msg, tkt, author)
Note: See TracChangeset for help on using the changeset viewer.