Changeset 406


Ignore:
Timestamp:
07/19/10 14:22:57 (14 years ago)
Author:
bas
Message:

converter all self.VERBOSE to self.logger.info

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/email2trac.py.in

    r405 r406  
    192192
    193193                self.DRY_RUN = parameters['dry_run']
    194                 self.VERBOSE = parameters['verbose']
    195194
    196195        def setup_log(self):
     
    238237                        self.parameters.log_level = self.parameters.log_level.upper()
    239238
    240                 if self.parameters.loglevel in ['DEBUG', 'ALL']:
     239                if self.parameters.log_level in ['DEBUG', 'ALL']:
    241240                        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:
    243243                        self.logger.setLevel(logging.INFO)
    244                 elif self.parameters.loglevel in ['ERROR']:
     244
     245                elif self.parameters.log_level in ['ERROR']:
    245246                        self.logger.setLevel(logging.ERROR)
    246                 elif self.parameters.loglevel in ['CRITICAL']:
     247
     248                elif self.parameters.log_level in ['CRITICAL']:
    247249                        self.logger.setLevel(logging.CRITICAL)
     250
    248251                else:
    249252                        self.logger.setLevel(logging.WARNING)
     
    251254                self.log_formatter = logging.Formatter(self.parameters.log_format)
    252255                self.log_handler.setFormatter(self.log_formatter)
     256
    253257                self.logger.addHandler(self.log_handler)
    254258                       
     
    624628                """
    625629                """
    626                 if self.VERBOSE:
    627                         print "VB: debug_attachments"
     630                self.logger.info('function debug_attachments')
    628631               
    629632                n = 0
     
    708711                understands it.
    709712                """
    710                 if self.VERBOSE:
    711                         print "VB: email_to_unicode"
     713                self.logger.info("function email_to_unicode")
    712714
    713715                results =  email.Header.decode_header(message_str)
     
    743745                Transfrom a string of the form [<key>=<value>]+ to dict[<key>] = <value>
    744746                """
    745                 if self.VERBOSE:
    746                         print "VB: str_to_dict"
     747                self.logger.info("function str_to_dict")
    747748
    748749                fields = string.split(s, self.SUBJECT_FIELD_SEPARATOR)
     
    821822                        - email2trac: ....
    822823                """
    823                 if self.VERBOSE:
    824                         print "VB: check_permission"
     824                self.logger.info("function check_permission")
    825825
    826826                if self.TICKET_PERMISSION_SYSTEM in ['trac']:
     
    854854                           2) Set default value for field (use_default=1)
    855855                """
    856                 if self.VERBOSE:
    857                         print "VB: update_ticket_fields"
     856                self.logger.info("function update_ticket_fields")
    858857
    859858                # Build a system dictionary from the ticket fields
     
    923922                creating a new one.
    924923                """
    925                 if self.VERBOSE:
    926                         print "VB: ticket_update: %s" %id
     924                self.logger.info("function ticket_update")
    927925
    928926                # Must we update ticket fields
     
    944942                        self.id = int(id[1:])
    945943
    946                 if self.VERBOSE:
    947                         print "VB: ticket_update: %s" %id
    948 
     944                self.logger.info("function ticket_update id %s" %id)
    949945
    950946                # When is the change committed
     
    11131109                So we must have the last column
    11141110                """
    1115                 if self.VERBOSE:
    1116                         print "VB: ticket_update_by_subject()"
     1111                self.logger.info('function ticket_update_by_subject')
    11171112
    11181113                matched_id = None
     
    11631158                Create a new ticket
    11641159                """
    1165                 if self.VERBOSE:
    1166                         print "VB: function new_ticket()"
     1160                self.logger.info('function new_ticket')
    11671161
    11681162                tkt = Ticket(self.env)
     
    12801274                save any attachments as files in the ticket's directory
    12811275                '''
    1282                 if self.VERBOSE:
    1283                         print "VB: attach_attachments()"
     1276                self.logger.info('function attach_attachments()')
    12841277
    12851278                if self.DRY_RUN:
     
    15991592                """
    16001593                self.logger.info('Main function parse')
    1601                 if self.VERBOSE:
    1602                         print "VB: main function parse()"
    16031594                global m
    16041595
     
    18641855                """
    18651856                """
    1866                 if self.VERBOSE:
    1867                         print "VB: inline_part()"
     1857                self.logger.info('function inline_part()')
    18681858
    18691859                return part.get_param('inline', None, 'Content-Disposition') == '' or not part.has_key('Content-Disposition')
     
    18741864                body parts are returned as strings, attachments are returned as tuples of (filename, Message object)
    18751865                """
    1876                 if self.VERBOSE:
    1877                         print "VB: get_message_parts()"
     1866                self.logger.info('function get_message_parts()')
    18781867
    18791868                message_parts = list()
     
    21312120                A wrapper for the TRAC notify function. So we can use templates
    21322121                """
    2133                 if self.VERBOSE:
    2134                         print "VB: notify()"
     2122                self.logger.info('function notify()')
    21352123
    21362124                if self.DRY_RUN:
Note: See TracChangeset for help on using the changeset viewer.