Changeset 406
- Timestamp:
- 07/19/10 14:22:57 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/email2trac.py.in
r405 r406 192 192 193 193 self.DRY_RUN = parameters['dry_run'] 194 self.VERBOSE = parameters['verbose']195 194 196 195 def setup_log(self): … … 238 237 self.parameters.log_level = self.parameters.log_level.upper() 239 238 240 if self.parameters.log level in ['DEBUG', 'ALL']:239 if self.parameters.log_level in ['DEBUG', 'ALL']: 241 240 self.logger.setLevel(logging.DEBUG) 242 elif self.parameters.loglevel in ['INFO'] or self.parameters['verbose']: 241 242 elif self.parameters.log_level in ['INFO'] or self.parameters.verbose: 243 243 self.logger.setLevel(logging.INFO) 244 elif self.parameters.loglevel in ['ERROR']: 244 245 elif self.parameters.log_level in ['ERROR']: 245 246 self.logger.setLevel(logging.ERROR) 246 elif self.parameters.loglevel in ['CRITICAL']: 247 248 elif self.parameters.log_level in ['CRITICAL']: 247 249 self.logger.setLevel(logging.CRITICAL) 250 248 251 else: 249 252 self.logger.setLevel(logging.WARNING) … … 251 254 self.log_formatter = logging.Formatter(self.parameters.log_format) 252 255 self.log_handler.setFormatter(self.log_formatter) 256 253 257 self.logger.addHandler(self.log_handler) 254 258 … … 624 628 """ 625 629 """ 626 if self.VERBOSE: 627 print "VB: debug_attachments" 630 self.logger.info('function debug_attachments') 628 631 629 632 n = 0 … … 708 711 understands it. 709 712 """ 710 if self.VERBOSE: 711 print "VB: email_to_unicode" 713 self.logger.info("function email_to_unicode") 712 714 713 715 results = email.Header.decode_header(message_str) … … 743 745 Transfrom a string of the form [<key>=<value>]+ to dict[<key>] = <value> 744 746 """ 745 if self.VERBOSE: 746 print "VB: str_to_dict" 747 self.logger.info("function str_to_dict") 747 748 748 749 fields = string.split(s, self.SUBJECT_FIELD_SEPARATOR) … … 821 822 - email2trac: .... 822 823 """ 823 if self.VERBOSE: 824 print "VB: check_permission" 824 self.logger.info("function check_permission") 825 825 826 826 if self.TICKET_PERMISSION_SYSTEM in ['trac']: … … 854 854 2) Set default value for field (use_default=1) 855 855 """ 856 if self.VERBOSE: 857 print "VB: update_ticket_fields" 856 self.logger.info("function update_ticket_fields") 858 857 859 858 # Build a system dictionary from the ticket fields … … 923 922 creating a new one. 924 923 """ 925 if self.VERBOSE: 926 print "VB: ticket_update: %s" %id 924 self.logger.info("function ticket_update") 927 925 928 926 # Must we update ticket fields … … 944 942 self.id = int(id[1:]) 945 943 946 if self.VERBOSE: 947 print "VB: ticket_update: %s" %id 948 944 self.logger.info("function ticket_update id %s" %id) 949 945 950 946 # When is the change committed … … 1113 1109 So we must have the last column 1114 1110 """ 1115 if self.VERBOSE: 1116 print "VB: ticket_update_by_subject()" 1111 self.logger.info('function ticket_update_by_subject') 1117 1112 1118 1113 matched_id = None … … 1163 1158 Create a new ticket 1164 1159 """ 1165 if self.VERBOSE: 1166 print "VB: function new_ticket()" 1160 self.logger.info('function new_ticket') 1167 1161 1168 1162 tkt = Ticket(self.env) … … 1280 1274 save any attachments as files in the ticket's directory 1281 1275 ''' 1282 if self.VERBOSE: 1283 print "VB: attach_attachments()" 1276 self.logger.info('function attach_attachments()') 1284 1277 1285 1278 if self.DRY_RUN: … … 1599 1592 """ 1600 1593 self.logger.info('Main function parse') 1601 if self.VERBOSE:1602 print "VB: main function parse()"1603 1594 global m 1604 1595 … … 1864 1855 """ 1865 1856 """ 1866 if self.VERBOSE: 1867 print "VB: inline_part()" 1857 self.logger.info('function inline_part()') 1868 1858 1869 1859 return part.get_param('inline', None, 'Content-Disposition') == '' or not part.has_key('Content-Disposition') … … 1874 1864 body parts are returned as strings, attachments are returned as tuples of (filename, Message object) 1875 1865 """ 1876 if self.VERBOSE: 1877 print "VB: get_message_parts()" 1866 self.logger.info('function get_message_parts()') 1878 1867 1879 1868 message_parts = list() … … 2131 2120 A wrapper for the TRAC notify function. So we can use templates 2132 2121 """ 2133 if self.VERBOSE: 2134 print "VB: notify()" 2122 self.logger.info('function notify()') 2135 2123 2136 2124 if self.DRY_RUN:
Note: See TracChangeset
for help on using the changeset viewer.