Exemple #1
0
def unknown_column_message(table, column, haystack=None):
    if haystack is None:
        haystack = map(lambda c: c.name, table.columns())
    logger.debug('haystack: %s', haystack)
    matches = get_close_matches(column, haystack)
    if not matches:
        return COLUMN_NOT_FOUND.format(
            column, table.name if table else '?',
            NO_CLOSE_MATCHES.format(u', '.join(haystack)))
    return COLUMN_NOT_FOUND.format(column, table.name if table else '?',
                                   CLOSE_MATCHES.format(u', '.join(matches)))
Exemple #2
0
def unknown_column_message(table, column, haystack=None):
    if haystack is None:
        haystack = map(lambda c: c.name, table.columns())
    logger.debug('haystack: %s', haystack)
    matches = get_close_matches(column, haystack)
    if not matches:
        return COLUMN_NOT_FOUND.format(
            column,
            table.name if table else '?',
            NO_CLOSE_MATCHES.format(u', '.join(haystack)))
    return COLUMN_NOT_FOUND.format(
        column,
        table.name if table else '?',
        CLOSE_MATCHES.format(u', '.join(matches)))
Exemple #3
0
    def init(argv, parser):
        options = Options(unicode_decode(argv), parser)

        logging.basicConfig(
            stream=options.logfile,
            level=options.loglevel,
            format="%(asctime)s %(levelname)s %(name)s: %(message)s",
            datefmt="%Y-%m-%d %H:%M:%S")

        logger.info("""
###
### %s called with args: %s
###""", parser.prog, options.argv)

        logger.debug("Options: %s", options)
        logger.debug(
            "Environment: %s",
            dict(
                filter(lambda (k, v): k.startswith('DBNAV_'),
                       os.environ.iteritems())))

        return options
Exemple #4
0
    def init(argv, parser):
        options = Options(unicode_decode(argv), parser)

        logging.basicConfig(
            stream=options.logfile,
            level=options.loglevel,
            format="%(asctime)s %(levelname)s %(name)s: %(message)s",
            datefmt="%Y-%m-%d %H:%M:%S")

        logger.info(
            """
###
### %s called with args: %s
###""",
            parser.prog, options.argv)

        logger.debug("Options: %s", options)
        logger.debug(
            "Environment: %s",
            dict(filter(
                lambda (k, v): k.startswith('DBNAV_'),
                os.environ.iteritems())))

        return options