コード例 #1
0
ファイル: __init__.py プロジェクト: shomah4a/sakuya
def main(args=sys.argv[1:]):

    parser = make_parser()

    opts = parser.parse_args(args)

    rtype = opts.types[-1]
    args = opts.types[:-1]

    session.initialize("sqlite:///" + opts.dbfile)

    with session.Session() as sess:
        results = functions.search_by_type(sess, rtype, args)
        output.print_result(results, opts)
コード例 #2
0
ファイル: __init__.py プロジェクト: shomah4a/sakuya
def main(args=sys.argv[1:]):

    parser = make_parser()

    opts = parser.parse_args(args)

    rtype = opts.types[-1]
    args = opts.types[:-1]

    session.initialize('sqlite:///' + opts.dbfile)

    with session.Session() as sess:
        results = functions.search_by_type(sess, rtype, args)
        output.print_result(results, opts)
コード例 #3
0
def get(req):
    u'''
    メソッド探して返す
    '''

    fmt = req.GET.get('format')
    rtype = req.GET.get('return')
    args = req.GET.get('args')

    if is_empty(args):
        args = []
    else:
        args = args.strip()

        if not args:
            args = []
        else:
            args = [x.strip() for x in args.split(',')]

    if rtype is not None:
        rtype = rtype.strip()

    if is_empty(rtype) and not args:
        result = []
    else:
        with session.Session() as sess:
            result = functions.search_by_type(sess, rtype, args)

    if fmt == 'json':
        return utils.make_json_resp(result)

    return zpt.rendering(
        'search',
        dict(results=result,
             request=req,
             return_type=rtype,
             args=', '.join(args)))
コード例 #4
0
ファイル: search.py プロジェクト: shomah4a/sakuya
def get(req):
    u'''
    メソッド探して返す
    '''

    fmt = req.GET.get('format')
    rtype = req.GET.get('return')
    args = req.GET.get('args')

    if is_empty(args):
        args = []
    else:
        args = args.strip()

        if not args:
            args = []
        else:
            args = [x.strip() for x in args.split(',')]


    if rtype is not None:
        rtype = rtype.strip()

    if is_empty(rtype) and not args:
        result = []
    else:
        with session.Session() as sess:
            result = functions.search_by_type(sess, rtype, args)

    if fmt == 'json':
        return utils.make_json_resp(result)

    return zpt.rendering('search', dict(results=result,
                                        request=req,
                                        return_type=rtype,
                                        args=', '.join(args)))