Example #1
0
def command_lookup(parser, args):
    name = u' '.join(args.criteria)

    session = get_session(args)
    lookup = get_lookup(args, session=session, recreate=False)

    results = lookup.lookup(name)
    if not results:
        print("No matches.")
    elif results[0].exact:
        print("Matched:")
    else:
        print("Fuzzy-matched:")

    for result in results:
        if hasattr(result.object, 'full_name'):
            name = result.object.full_name
        else:
            name = result.object.name

        print("%s: %s" % (result.object.__tablename__, name), end='')
        if result.language:
            print("(%s in %s)" % (result.name, result.language))
        else:
            print()
Example #2
0
def command_lookup(*args):
    parser = get_parser(verbose=False)
    options, words = parser.parse_args(list(args))

    name = ' '.join(words)

    session = get_session(options)
    lookup = get_lookup(options, session=session, recreate=False)

    results = lookup.lookup(name)
    if not results:
        print("No matches.")
    elif results[0].exact:
        print("Matched:")
    else:
        print("Fuzzy-matched:")

    for result in results:
        if hasattr(result.object, 'full_name'):
            name = result.object.full_name
        else:
            name = result.object.name

        print("%s: %s" % (result.object.__tablename__, name), end=' ')
        if result.language:
            print("(%s in %s)" % (result.name, result.language))
        else:
            print()
Example #3
0
def command_lookup(*args):
    parser = get_parser(verbose=False)
    options, words = parser.parse_args(list(args))

    name = u' '.join(words)

    session = get_session(options)
    lookup = get_lookup(options, session=session, recreate=False)

    results = lookup.lookup(name)
    if not results:
        print "No matches."
    elif results[0].exact:
        print "Matched:"
    else:
        print "Fuzzy-matched:"

    for result in results:
        if hasattr(result.object, 'full_name'):
            name = result.object.full_name
        else:
            name = result.object.name

        print "%s: %s" % (result.object.__tablename__, name),
        if result.language:
            print "(%s in %s)" % (result.name, result.language)
        else:
            print
Example #4
0
def command_lookup(parser, args):
    name = u' '.join(args.criteria)

    session = get_session(args)
    lookup = get_lookup(args, session=session, recreate=False)

    results = lookup.lookup(name)
    if not results:
        print("No matches.")
    elif results[0].exact:
        print("Matched:")
    else:
        print("Fuzzy-matched:")

    for result in results:
        if hasattr(result.object, 'full_name'):
            name = result.object.full_name
        else:
            name = result.object.name

        print("%s: %s" % (result.object.__tablename__, name), end='')
        if result.language:
            print("(%s in %s)" % (result.name, result.language))
        else:
            print()