コード例 #1
0
ファイル: server.py プロジェクト: priestc/LibraryDSS
def items(query=None, user=LOGGED_IN_USER, username=USER):
    """
    Given an LQL query and a library identity, return the items that match.
    """
    library = Library.objects.get()
    items = Item.objects.all()
    query_json = '[]'

    if query:
        from query import execute_query, parse_query
        parsed = parse_query(query)
        items = execute_query(items, parsed)
        # this json representation of the query that was just used to filter
        # the items will be passed back to the template as a json string
        # so the front end can render the query widget. A string representation
        # is not passed because there is no way to parse LQL in javascript (yet).
        query_json = jsonify(parsed)

    items = items.all()
    all_keys = []
    return {
        'parsed_query_json': query_json,
        'library_items': items,
        'items_count': len(items),
        'keys': all_keys,
    }
コード例 #2
0
ファイル: __init__.py プロジェクト: AkademieOlympia/giotto
 def generic_json(self, result, errors):
     return {'body': jsonify(result), 'mimetype': 'application/json'}
コード例 #3
0
 def renderer(self, data, errors):
     return jsonify(data)
コード例 #4
0
 def generic_json(self, result, errors):
     return {'body': jsonify(result), 'mimetype': 'application/json'}