- Timestamp:
- 05/27/08 14:10:55 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/email2trac.py.in
r199 r201 107 107 trac_default_version = '0.10' 108 108 m = None 109 DRY_RUN = False 109 110 110 111 … … 520 521 ticket[field] = value 521 522 522 523 524 523 def ticket_update(self, m): 525 524 """ … … 618 617 tkt['version'] = self.get_config('ticket', 'default_version') 619 618 619 tkt['type'] = self.get_config('ticket', 'default_type') 620 if settings.has_key('component'): 621 tkt['component'] = settings['component'] 622 else: 623 tkt['component'] = self.get_config('ticket', 'default_component') 624 tkt['component'] = component 625 620 626 if not msg['Subject']: 621 627 tkt['summary'] = u'(No subject)' … … 623 629 tkt['summary'] = self.email_to_unicode(msg['Subject']) 624 630 625 if settings.has_key('component'):626 tkt['component'] = settings['component']627 else:628 tkt['component'] = component629 631 630 632 # Set default owner for component, HvB 631 633 # Is not necessary, because if component is set. The trac code 632 # will find the owner: self.set_owner(tkt) 633 # 634 # will find the owner: 635 # 636 # self.set_owner(tkt) 637 634 638 self.set_reply_fields(tkt, msg) 635 639 … … 650 654 when = datetime.now(utc) 651 655 652 ticket_id = tkt.insert() 653 #try: 654 # ticket_id = tkt.insert() 655 #except OperationalError, detail: 656 # syslog.openlog('email2trac', syslog.LOG_NOWAIT) 657 # syslog.syslog('catch tkt insert problem %s' %detail) 658 # syslog.closelog() 659 # 660 # ticket_id = tkt.insert() 656 if DRY_RUN: 657 ticket_id = 'DRY_RUN' 658 else: 659 ticket_id = tkt.insert() 661 660 662 661 tkt['id'] = ticket_id … … 680 679 681 680 if changed: 682 tkt.save_changes(self.author, comment) 683 #print tkt.get_changelog(self.db, when) 681 if DRY_RUN: 682 print 'DRY_RUN: tkt.save_changes(self.author, comment)' 683 else: 684 tkt.save_changes(self.author, comment) 685 #print tkt.get_changelog(self.db, when) 684 686 685 687 if self.notification: … … 1051 1053 component = '' 1052 1054 ENABLE_SYSLOG = 0 1055 1056 SHORT_OPT = ''chf:np:' 1057 LONG_OPT = ['component=', 'dry-run', 'help', 'file=', 'project='] 1058 1059 global DRY_RUN 1053 1060 1054 1061 try: 1055 opts, args = getopt.getopt(sys.argv[1:], 'chf:p:', ['component=','help', 'file=', 'project='])1062 opts, args = getopt.getopt(sys.argv[1:], SHORT_OPT, LONG_OPT) 1056 1063 except getopt.error,detail: 1057 1064 print __doc__ … … 1068 1075 elif opt in ['-f', '--file']: 1069 1076 configfile = value 1077 elif opt in ['-n', '--dry-run']: 1078 DRY_RUN = True 1070 1079 elif opt in ['-p', '--project']: 1071 1080 project_name = value
Note: See TracChangeset
for help on using the changeset viewer.