def get_config(args): config_file = getattr(args, 'config_file') if config_file is None: config_file = DEFAULT_CONFIG_FILE section = getattr(args, 'connection') parser = ConfigParser.ConfigParser() config_file_name = os.path.expanduser(config_file) # try to open config file try: file = open(config_file_name) except IOError: if getattr(args, 'config_file') is not None: log_error("Error: Can't find user configuration file: " +config_file_name) sys.exit(1) else: return # try to parse config file try: parser.readfp(file) sections = parser.sections() except ConfigParser.ParsingError, e: log_error("Error: Can't parse user configuration file: "+str(e)) sys.exit(1)
def main(): ArgParser = make_arg_parser() args = ArgParser.parse_args() ConfigParser = load_config(getattr(args, 'config_file', None)) check_bugz_token() settings = Settings(args, ConfigParser) if not hasattr(args, 'func'): ArgParser.print_usage() return 1 try: args.func(settings) except BugzError as error: log_error(error) return 1 except RuntimeError as error: log_error(error) return 1 except KeyboardInterrupt: log_info('Stopped due to keyboard interrupt') return 1 return 0
def config_option(parser, get, section, option): if parser.has_option(section, option): try: if get(section, option) != '': return get(section, option) else: log_error("Error: "+option+" is not set") sys.exit(1) except ValueError, e: log_error("Error: option "+option+ " is not in the right format: "+str(e)) sys.exit(1)
def get_config_option(get, section, option): try: value = get(section, option) if value == '': log_error('{0} is not set'.format(option)) sys.exit(1) return value except ValueError as e: log_error('{0} is not in the right format: {1}'.format(option, str(e))) sys.exit(1)
def config_option(parser, get, section, option): if parser.has_option(section, option): try: if get(section, option) != '': return get(section, option) else: log_error("Error: "+option+" is not set") sys.exit(1) except ValueError as e: log_error("Error: option "+option+ " is not in the right format: "+str(e)) sys.exit(1)
def get_config_option(get, section, option): try: value = get(section, option) if value == '': log_error("Error: " + option + " is not set") sys.exit(1) return value except ValueError as e: log_error("Error: option " + option + " is not in the right format: " + str(e)) sys.exit(1)
def load_config(UserConfig=None): parser = configparser.ConfigParser(default_section='default') DefaultConfigs = sorted(glob.glob(sys.prefix + '/share/pybugz.d/*.conf')) SystemConfigs = sorted(glob.glob('/etc/pybugz.d/*.conf')) if UserConfig is not None: UserConfig = os.path.expanduser(UserConfig) else: UserConfig = os.path.expanduser('~/.bugzrc') try: parser.read(DefaultConfigs + SystemConfigs + [UserConfig]) except configparser.DuplicateOptionError as error: log_error(error) sys.exit(1) except configparser.DuplicateSectionError as error: log_error(error) sys.exit(1) except configparser.MissingSectionHeaderError as error: log_error(error) sys.exit(1) except configparser.ParsingError as error: log_error(error) sys.exit(1) return parser
def get_config_option(get, section, option): try: value = get(section, option) except ValueError as error: log_error('{0} is not in the right format: {1}'.format( option, str(error))) sys.exit(1) if value == '': log_error('{0} is not set'.format(option)) sys.exit(1) return value
def read_config(parser, ConfigFiles): try: parser.read(ConfigFiles) except configparser.DuplicateOptionError as e: log_error(e) sys.exit(1) except configparser.DuplicateSectionError as e: log_error(e) sys.exit(1) except configparser.MissingSectionHeaderError as e: log_error(e) sys.exit(1) except configparser.ParsingError as e: log_error(e) sys.exit(1)
def get_config_option(get, section, option): try: value = get(section, option) except configparser.InterpolationSyntaxError as error: log_error('Syntax Error in configuration file: {0}'.format(error)) sys.exit(1) except ValueError as error: log_error('{0} is not in the right format: {1}'.format(option, str(error))) sys.exit(1) if value == '': log_error('{0} is not set'.format(option)) sys.exit(1) return value
def get_config_option(get, section, option): try: value = get(section, option) except configparser.InterpolationSyntaxError as error: log_error('Syntax Error in configuration file: {0}'.format(error)) sys.exit(1) except ValueError as error: log_error('{0} is not in the right format: {1}'.format( option, str(error))) sys.exit(1) if value == '': log_error('{0} is not set'.format(option)) sys.exit(1) return value
def get_config(args): config_file = getattr(args, 'config_file') if config_file is None: config_file = DEFAULT_CONFIG_FILE section = getattr(args, 'connection') parser = configparser.ConfigParser() config_file_name = os.path.expanduser(config_file) # try to open config file try: file = open(config_file_name) except IOError: if getattr(args, 'config_file') is not None: log_error("Error: Can't find user configuration file: " +config_file_name) sys.exit(1) else: return # try to parse config file try: parser.readfp(file) sections = parser.sections() except configparser.ParsingError as e: log_error("Error: Can't parse user configuration file: "+str(e)) sys.exit(1) # parse the default section first if "default" in sections: fill_config(args, parser, "default") if section is None: section = config_option(parser, parser.get, "default", "connection") # parse a specific section if section in sections: fill_config(args, parser, section) elif section is not None: log_error("Error: Can't find section ["+section +"] in configuration file") sys.exit(1)
def __init__(self, args, config): for attr, value in args.__dict__.items(): sv = getattr(self, attr, None) if sv != value: setattr(self, attr, value) if not hasattr(self, "connection"): if config.has_option("default", "connection"): self.connection = get_config_option(config.get, "default", "connection") else: log_error("No default connection specified") sys.exit(1) if not self.connection in config.sections(): log_error('connection "{0}" not found'.format(self.connection)) sys.exit(1) if not hasattr(self, "base"): if config.has_option(self.connection, "base"): self.base = get_config_option(config.get, self.connection, "base") else: log_error("No base URL specified") sys.exit(1) if not hasattr(self, "user"): if config.has_option(self.connection, "user"): self.user = get_config_option(config.get, self.connection, "user") if not hasattr(self, "password"): if config.has_option(self.connection, "password"): self.password = get_config_option(config.get, self.connection, "password") if not hasattr(self, "passwordcmd"): if config.has_option(self.connection, "passwordcmd"): self.passwordcmd = get_config_option(config.get, self.connection, "passwordcmd") if not hasattr(self, "columns"): if config.has_option(self.connection, "columns"): self.columns = get_config_option(config.getint, self.connection, "columns") else: self.columns = terminal_width() if not hasattr(self, "debug"): if config.has_option(self.connection, "debug"): self.debug = get_config_option(config.getint, self.connection, "debug") else: self.debug = 0 if not hasattr(self, "quiet"): if config.has_option(self.connection, "quiet"): self.quiet = get_config_option(config.getboolean, self.connection, "quiet") else: self.quiet = False if not hasattr(self, "skip_auth"): if config.has_option(self.connection, "skip_auth"): self.skip_auth = get_config_option(config.getboolean, self.connection, "skip_auth") else: self.skip_auth = False if getattr(self, "encoding", None) is not None: log_info("The encoding option is deprecated.") log_setDebugLevel(self.debug) log_setQuiet(self.quiet) log_debug("Connection debug dump:", 3) for attr, value in self.__dict__.items(): log_debug("{0}, {1}".format(attr, getattr(self, attr)), 3) log_info("Using [{0}] ({1})".format(self.connection, self.base))
def post(settings): """Post a new bug""" login(settings) # load description from file if possible if hasattr(settings, 'description_from'): try: if settings.description_from == '-': settings.description = sys.stdin.read() else: settings.description = \ open(settings.description_from, 'r').read() except IOError as error: raise BugzError('Unable to read from file: %s: %s' % (settings.description_from, error)) if not hasattr(settings, 'batch') and not hasattr(settings, 'template'): prompt_for_bug(settings) params = {} if hasattr(settings, 'template'): tmpl = configparser.ConfigParser() try: tmpl.read(settings.template) msection = tmpl['Default']['type'] for key in tmpl[msection]: params[key] = tmpl[msection][key] print('%-12s: %s' % (key, params[key])) except configparser.DuplicateOptionError as error: log_error(error) sys.exit(1) except configparser.DuplicateSectionError as error: log_error(error) sys.exit(1) except configparser.MissingSectionHeaderError as error: log_error(error) sys.exit(1) except configparser.ParsingError as error: log_error(error) sys.exit(1) else: # raise an exception if mandatory fields are not specified. if not hasattr(settings, 'product'): raise RuntimeError('Product not specified') if not hasattr(settings, 'component'): raise RuntimeError('Component not specified') if not hasattr(settings, 'summary'): raise RuntimeError('Title not specified') if not hasattr(settings, 'description'): raise RuntimeError('Description not specified') print('-' * (settings.columns - 1)) print('%-12s: %s' % ('Product', settings.product)) print('%-12s: %s' % ('Component', settings.component)) print('%-12s: %s' % ('Title', settings.summary)) if hasattr(settings, 'version'): print('%-12s: %s' % ('Version', settings.version)) print('%-12s: %s' % ('Description', settings.description)) if hasattr(settings, 'op_sys'): print('%-12s: %s' % ('Operating System', settings.op_sys)) if hasattr(settings, 'platform'): print('%-12s: %s' % ('Platform', settings.platform)) if hasattr(settings, 'priority'): print('%-12s: %s' % ('Priority', settings.priority)) if hasattr(settings, 'severity'): print('%-12s: %s' % ('Severity', settings.severity)) if hasattr(settings, 'alias'): print('%-12s: %s' % ('Alias', settings.alias)) if hasattr(settings, 'assigned_to'): print('%-12s: %s' % ('Assigned to', settings.assigned_to)) if hasattr(settings, 'cc'): print('%-12s: %s' % ('CC', settings.cc)) if hasattr(settings, 'url'): print('%-12s: %s' % ('URL', settings.url)) print('-' * (settings.columns - 1)) params['product'] = settings.product params['component'] = settings.component if hasattr(settings, 'version'): params['version'] = settings.version params['summary'] = settings.summary if hasattr(settings, 'description'): params['description'] = settings.description if hasattr(settings, 'op_sys'): params['op_sys'] = settings.op_sys if hasattr(settings, 'platform'): params['platform'] = settings.platform if hasattr(settings, 'priority'): params['priority'] = settings.priority if hasattr(settings, 'severity'): params['severity'] = settings.severity if hasattr(settings, 'alias'): params['alias'] = settings.alias if hasattr(settings, 'assigned_to'): params['assigned_to'] = settings.assigned_to if hasattr(settings, 'cc'): params['cc'] = settings.cc if hasattr(settings, 'url'): params['url'] = settings.url # append the output from append_command to the description append_command = getattr(settings, 'append_command', None) if append_command is not None and append_command != '': append_command_output = subprocess.getoutput(append_command) settings.description = settings.description + '\n\n' + \ '$ ' + append_command + '\n' + \ append_command_output if not hasattr(settings, 'batch'): if settings.default_confirm in ['Y', 'y']: confirm = input('Confirm bug submission (Y/n)? ') else: confirm = input('Confirm bug submission (y/N)? ') if len(confirm) < 1: confirm = settings.default_confirm if confirm[0] not in ('y', 'Y'): log_info('Submission aborted') return result = settings.call_bz(settings.bz.Bug.create, params) log_info('Bug %d submitted' % result['id'])
def __init__(self, args, config): for key in vars(args): setattr(self, key, getattr(args, key)) if not hasattr(self, 'connection'): if config.has_option('default', 'connection'): self.connection = get_config_option(config.get, 'default', 'connection') else: log_error('No default connection specified') sys.exit(1) if self.connection not in config.sections(): log_error('connection "{0}" not found'.format(self.connection)) sys.exit(1) if not hasattr(self, 'base'): if config.has_option(self.connection, 'base'): self.base = get_config_option(config.get, self.connection, 'base') else: log_error('No base URL specified') sys.exit(1) if not hasattr(self, 'component'): if config.has_option(self.connection, 'component'): self.component = get_config_option(config.get, self.connection, 'component') if not hasattr(self, 'user'): if config.has_option(self.connection, 'user'): self.user = get_config_option(config.get, self.connection, 'user') if not hasattr(self, 'password'): if config.has_option(self.connection, 'password'): self.password = get_config_option(config.get, self.connection, 'password') if not hasattr(self, 'passwordcmd'): if config.has_option(self.connection, 'passwordcmd'): self.passwordcmd = get_config_option(config.get, self.connection, 'passwordcmd') if not hasattr(self, 'key'): if config.has_option(self.connection, 'key'): self.key = get_config_option(config.get, self.connection, 'key') if not hasattr(self, 'product'): if config.has_option(self.connection, 'product'): self.product = get_config_option(config.get, self.connection, 'product') if not hasattr(self, 'columns'): if config.has_option(self.connection, 'columns'): self.columns = get_config_option(config.getint, self.connection, 'columns') else: self.columns = terminal_width() if not hasattr(self, 'debug'): if config.has_option(self.connection, 'debug'): self.debug = get_config_option(config.getint, self.connection, 'debug') else: self.debug = 0 log_setDebugLevel(self.debug) if not hasattr(self, 'quiet'): if config.has_option(self.connection, 'quiet'): self.quiet = get_config_option(config.getboolean, self.connection, 'quiet') else: self.quiet = False log_setQuiet(self.quiet) if not hasattr(self, 'search_statuses'): if config.has_option(self.connection, 'search_statuses'): s = get_config_option(config.get, self.connection, 'search_statuses') self.search_statuses = [x.strip() for x in s.split(',')] if not hasattr(self, 'skip_auth'): if config.has_option(self.connection, 'skip_auth'): self.skip_auth = get_config_option(config.getboolean, self.connection, 'skip_auth') else: self.skip_auth = False if not hasattr(self, 'interactive'): if config.has_option(self.connection, 'interactive'): self.interactive = get_config_option(config.getboolean, self.connection, 'interactive') else: self.interactive = False if not hasattr(self, 'insecure'): if config.has_option(self.connection, 'insecure'): self.insecure = get_config_option(config.getboolean, self.connection, 'insecure') else: self.insecure = False if getattr(self, 'encoding', None) is not None: log_info('The encoding option is deprecated.') if self.insecure: context=ssl._create_unverified_context() else: context = None self.bz = xmlrpc.client.ServerProxy(self.base, context=context) self.connections = config.sections() parse_result = urllib.parse.urlparse(self.base) new_netloc = parse_result.netloc.split('@')[-1] self.safe_base = parse_result._replace(netloc=new_netloc).geturl() log_info("Using [{0}] ({1})".format(self.connection, self.safe_base)) log_debug('Command line debug dump:', 3) for key in vars(args): log_debug('{0}, {1}'.format(key, getattr(args, key)), 3) log_debug('Settings debug dump:', 3) for key in vars(self): log_debug('{0}, {1}'.format(key, getattr(self, key)), 3)
file = open(config_file_name) except IOError: if getattr(args, 'config_file') is not None: log_error("Error: Can't find user configuration file: " +config_file_name) sys.exit(1) else: return # try to parse config file try: parser.readfp(file) sections = parser.sections() except ConfigParser.ParsingError, e: log_error("Error: Can't parse user configuration file: "+str(e)) sys.exit(1) # parse the default section first if "default" in sections: fill_config(args, parser, "default") if section is None: section = config_option(parser, parser.get, "default", "connection") # parse a specific section if section in sections: fill_config(args, parser, section) elif section is not None: log_error("Error: Can't find section ["+section +"] in configuration file") sys.exit(1)
def __init__(self, args, config): for key in vars(args): setattr(self, key, getattr(args, key)) if not hasattr(self, 'connection'): if config.has_option('default', 'connection'): self.connection = get_config_option(config.get, 'default', 'connection') else: log_error('No default connection specified') sys.exit(1) if self.connection not in config.sections(): log_error('connection "{0}" not found'.format(self.connection)) sys.exit(1) if not hasattr(self, 'base'): if config.has_option(self.connection, 'base'): self.base = get_config_option(config.get, self.connection, 'base') else: log_error('No base URL specified') sys.exit(1) if not hasattr(self, 'component'): if config.has_option(self.connection, 'component'): self.component = get_config_option(config.get, self.connection, 'component') if not hasattr(self, 'user'): if config.has_option(self.connection, 'user'): self.user = get_config_option(config.get, self.connection, 'user') if not hasattr(self, 'password'): if config.has_option(self.connection, 'password'): self.password = get_config_option(config.get, self.connection, 'password') if not hasattr(self, 'passwordcmd'): if config.has_option(self.connection, 'passwordcmd'): self.passwordcmd = get_config_option(config.get, self.connection, 'passwordcmd') if not hasattr(self, 'product'): if config.has_option(self.connection, 'product'): self.product = get_config_option(config.get, self.connection, 'product') if not hasattr(self, 'columns'): if config.has_option(self.connection, 'columns'): self.columns = get_config_option(config.getint, self.connection, 'columns') else: self.columns = terminal_width() if not hasattr(self, 'debug'): if config.has_option(self.connection, 'debug'): self.debug = get_config_option(config.getint, self.connection, 'debug') else: self.debug = 0 log_setDebugLevel(self.debug) if not hasattr(self, 'quiet'): if config.has_option(self.connection, 'quiet'): self.quiet = get_config_option(config.getboolean, self.connection, 'quiet') else: self.quiet = False log_setQuiet(self.quiet) if config.has_option(self.connection, 'search_statuses'): self.search_statuses = get_config_option( config.get, self.connection, 'search_statuses').split() if not hasattr(self, 'skip_auth'): if config.has_option(self.connection, 'skip_auth'): self.skip_auth = get_config_option(config.getboolean, self.connection, 'skip_auth') else: self.skip_auth = False if getattr(self, 'encoding', None) is not None: log_info('The encoding option is deprecated.') self.bz = xmlrpc.client.ServerProxy(self.base) self.connections = config.sections() parse_result = urllib.parse.urlparse(self.base) new_netloc = parse_result.netloc.split('@')[-1] self.safe_base = parse_result._replace(netloc=new_netloc).geturl() self.tokens = Tokens() self.bz_token = None old_token_file = os.path.join(os.environ['HOME'], '.bugz_token') try: old_token = open(old_token_file).read().strip() self.save_token(old_token) os.remove(old_token_file) print('Your ~/.bugz_token file was moved to ~/.bugz_tokens') print('The token was assigned to the {0} connection'.format( self.connection)) print('If this is not correct, please edit ~/.bugz_tokens') print('and adjust the name of the connection.') print('This is the name enclosed in square brackets.') print('The connections command lists known connections.') except (IOError, OSError): pass log_info("Using [{0}] ({1})".format(self.connection, self.safe_base)) log_debug('Command line debug dump:', 3) for key in vars(args): log_debug('{0}, {1}'.format(key, getattr(args, key)), 3) log_debug('Connection debug dump:', 3) for key in vars(self): log_debug('{0}, {1}'.format(key, getattr(self, key)), 3)
def __init__(self, args, config): for attr, value in args.__dict__.items(): sv = getattr(self, attr, None) if sv != value: setattr(self, attr, value) if not hasattr(self, 'connection'): if config.has_option('default', 'connection'): self.connection = get_config_option(config.get, 'default', 'connection') else: log_error('No default connection specified') sys.exit(1) self.token_file = os.path.join(os.environ['HOME'], DEFAULT_TOKEN_FILE) self.bz_token = None if self.connection not in config.sections(): log_error('connection "{0}" not found'.format(self.connection)) sys.exit(1) if not hasattr(self, 'base'): if config.has_option(self.connection, 'base'): self.base = get_config_option(config.get, self.connection, 'base') else: log_error('No base URL specified') sys.exit(1) self.bz = BugzillaProxy(self.base) if not hasattr(self, 'user'): if config.has_option(self.connection, 'user'): self.user = get_config_option(config.get, self.connection, 'user') if not hasattr(self, 'password'): if config.has_option(self.connection, 'password'): self.password = get_config_option(config.get, self.connection, 'password') if not hasattr(self, 'passwordcmd'): if config.has_option(self.connection, 'passwordcmd'): self.passwordcmd = get_config_option(config.get, self.connection, 'passwordcmd') if not hasattr(self, 'columns'): if config.has_option(self.connection, 'columns'): self.columns = get_config_option(config.getint, self.connection, 'columns') else: self.columns = terminal_width() if not hasattr(self, 'debug'): if config.has_option(self.connection, 'debug'): self.debug = get_config_option(config.getint, self.connection, 'debug') else: self.debug = 0 if not hasattr(self, 'quiet'): if config.has_option(self.connection, 'quiet'): self.quiet = get_config_option(config.getboolean, self.connection, 'quiet') else: self.quiet = False if not hasattr(self, 'skip_auth'): if config.has_option(self.connection, 'skip_auth'): self.skip_auth = get_config_option(config.getboolean, self.connection, 'skip_auth') else: self.skip_auth = False if getattr(self, 'encoding', None) is not None: log_info('The encoding option is deprecated.') log_setDebugLevel(self.debug) log_setQuiet(self.quiet) log_debug('Connection debug dump:', 3) for attr, value in self.__dict__.items(): log_debug('{0}, {1}'.format(attr, getattr(self, attr)), 3) log_info("Using [{0}] ({1})".format(self.connection, self.base))
def __init__(self, args, config): for key in vars(args): setattr(self, key, getattr(args, key)) if not hasattr(self, 'connection'): if config.has_option('default', 'connection'): self.connection = get_config_option(config.get, 'default', 'connection') else: log_error('No default connection specified') sys.exit(1) if self.connection not in config.sections(): log_error('connection "{0}" not found'.format(self.connection)) sys.exit(1) if not hasattr(self, 'base'): if config.has_option(self.connection, 'base'): self.base = get_config_option(config.get, self.connection, 'base') else: log_error('No base URL specified') sys.exit(1) if not hasattr(self, 'component'): if config.has_option(self.connection, 'component'): self.component = get_config_option(config.get, self.connection, 'component') if not hasattr(self, 'user'): if config.has_option(self.connection, 'user'): self.user = get_config_option(config.get, self.connection, 'user') if not hasattr(self, 'password'): if config.has_option(self.connection, 'password'): self.password = get_config_option(config.get, self.connection, 'password') if not hasattr(self, 'passwordcmd'): if config.has_option(self.connection, 'passwordcmd'): self.passwordcmd = get_config_option(config.get, self.connection, 'passwordcmd') if not hasattr(self, 'product'): if config.has_option(self.connection, 'product'): self.product = get_config_option(config.get, self.connection, 'product') if not hasattr(self, 'columns'): if config.has_option(self.connection, 'columns'): self.columns = get_config_option(config.getint, self.connection, 'columns') else: self.columns = terminal_width() if not hasattr(self, 'debug'): if config.has_option(self.connection, 'debug'): self.debug = get_config_option(config.getint, self.connection, 'debug') else: self.debug = 0 log_setDebugLevel(self.debug) if not hasattr(self, 'quiet'): if config.has_option(self.connection, 'quiet'): self.quiet = get_config_option(config.getboolean, self.connection, 'quiet') else: self.quiet = False log_setQuiet(self.quiet) if config.has_option(self.connection, 'search_statuses'): self.search_statuses = get_config_option(config.get, self.connection, 'search_statuses').split() if not hasattr(self, 'skip_auth'): if config.has_option(self.connection, 'skip_auth'): self.skip_auth = get_config_option(config.getboolean, self.connection, 'skip_auth') else: self.skip_auth = False if getattr(self, 'encoding', None) is not None: log_info('The encoding option is deprecated.') self.bz = xmlrpc.client.ServerProxy(self.base) self.connections = config.sections() parse_result = urllib.parse.urlparse(self.base) new_netloc = parse_result.netloc.split('@')[-1] self.safe_base = parse_result._replace(netloc=new_netloc).geturl() self.tokens = Tokens() self.bz_token = None old_token_file = os.path.join(os.environ['HOME'], '.bugz_token') try: old_token = open(old_token_file).read().strip() self.save_token(old_token) os.remove(old_token_file) print('Your ~/.bugz_token file was moved to ~/.bugz_tokens') print('The token was assigned to the {0} connection' .format(self.connection)) print('If this is not correct, please edit ~/.bugz_tokens') print('and adjust the name of the connection.') print('This is the name enclosed in square brackets.') print('The connections command lists known connections.') except (IOError, OSError): pass log_info("Using [{0}] ({1})".format(self.connection, self.safe_base)) log_debug('Command line debug dump:', 3) for key in vars(args): log_debug('{0}, {1}'.format(key, getattr(args, key)), 3) log_debug('Connection debug dump:', 3) for key in vars(self): log_debug('{0}, {1}'.format(key, getattr(self, key)), 3)
sections = parser.sections() except ConfigParser.ParsingError, e: log_error("Error: Can't parse user configuration file: "+str(e)) sys.exit(1) # parse the default section first if "default" in sections: fill_config(args, parser, "default") if section is None: section = config_option(parser, parser.get, "default", "connection") # parse a specific section if section in sections: fill_config(args, parser, section) elif section is not None: log_error("Error: Can't find section ["+section +"] in configuration file") sys.exit(1) ########NEW FILE######## __FILENAME__ = errhandling # # Bugz specific exceptions # class BugzError(Exception): pass ########NEW FILE######## __FILENAME__ = log #This module contains a set of common routines for logging messages. # TODO: use the python's 'logging' feature?