Beispiel #1
0
def reference_data():
    etag_cache_keygen('static')
    return jsonify({
        'currencies': sorted(dicts(CURRENCIES), key=lambda d: d['label']),
        'languages': sorted(dicts(LANGUAGES), key=lambda d: d['label']),
        'territories': sorted(dicts(COUNTRIES), key=lambda d: d['label']),
        'categories': sorted(dicts(CATEGORIES), key=lambda d: d['label'])
    })
Beispiel #2
0
def reference_data():
    etag_cache_keygen('static')
    return jsonify({
        'currencies':
        sorted(dicts(CURRENCIES), key=lambda d: d['label']),
        'languages':
        sorted(dicts(LANGUAGES), key=lambda d: d['label']),
        'territories':
        sorted(dicts(COUNTRIES), key=lambda d: d['label']),
        'categories':
        sorted(dicts(CATEGORIES), key=lambda d: d['label'])
    })
Beispiel #3
0
def authz():
    obj = Dataset.by_name(request.args.get('dataset'))
    etag_cache_keygen(obj, private=True)
    if obj is None:
        return jsonify({
            'read': False,
            'update': False
        })
    return jsonify({
        'read': dataset.read(obj),
        'update': dataset.update(obj)
    })
Beispiel #4
0
def index(*a, **kw):
    from flask.ext.babel import get_locale
    from spendb.views.context import etag_cache_keygen
    etag_cache_keygen(RESERVED_TERMS)
    locale = get_locale()
    data = {
        'current_language': locale.language,
        'url_for': url_for,
        'debug': current_app.config['DEBUG'],
        'asset_link': asset_link,
        'reserved_terms': RESERVED_TERMS,
        'site_url': url_for('home.index').rstrip('/'),
        'site_title': current_app.config.get('SITE_TITLE')
    }
    return render_template('layout.html', **data)
Beispiel #5
0
def index(*a, **kw):
    from flask.ext.babel import get_locale
    from spendb.views.context import etag_cache_keygen
    etag_cache_keygen(RESERVED_TERMS)
    locale = get_locale()
    data = {
        'current_language': locale.language,
        'url_for': url_for,
        'debug': current_app.config['DEBUG'],
        'asset_link': asset_link,
        'reserved_terms': RESERVED_TERMS,
        'site_url': url_for('home.index').rstrip('/'),
        'site_title': current_app.config.get('SITE_TITLE')
    }
    return render_template('layout.html', **data)
Beispiel #6
0
def index(*a, **kw):
    from flask.ext.babel import get_locale
    from spendb.views.context import etag_cache_keygen
    etag_cache_keygen(RESERVED_TERMS)
    locale = get_locale()
    data = {
        'current_language': locale.language,
        'url_for': url_for,
        'reserved_terms': RESERVED_TERMS,
        'templates': angular_templates(current_app),
        'site_url': url_for('home.index').rstrip('/'),
        'number_symbols_group': locale.number_symbols.get('group'),
        'number_symbols_decimal': locale.number_symbols.get('decimal'),
        'site_title': current_app.config.get('SITE_TITLE')
    }
    return render_template('layout.html', **data)
Beispiel #7
0
def index(*a, **kw):
    from flask.ext.babel import get_locale
    from spendb.views.context import etag_cache_keygen
    etag_cache_keygen(RESERVED_TERMS)
    locale = get_locale()
    data = {
        'current_language': locale.language,
        'url_for': url_for,
        'reserved_terms': RESERVED_TERMS,
        'templates': angular_templates(current_app),
        'site_url': url_for('home.index').rstrip('/'),
        'number_symbols_group': locale.number_symbols.get('group'),
        'number_symbols_decimal': locale.number_symbols.get('decimal'),
        'site_title': current_app.config.get('SITE_TITLE')
    }
    return render_template('layout.html', **data)
Beispiel #8
0
def authz():
    obj = Dataset.by_name(request.args.get('dataset'))
    etag_cache_keygen(obj, private=True)
    if obj is None:
        return jsonify({'read': False, 'update': False})
    return jsonify({'read': dataset.read(obj), 'update': dataset.update(obj)})
Beispiel #9
0
def view(name):
    dataset = get_dataset(name)
    etag_cache_keygen(dataset, private=dataset.private)
    return jsonify(dataset)
Beispiel #10
0
def managers(name):
    dataset = get_dataset(name)
    etag_cache_keygen(dataset, private=dataset.private)
    return jsonify({'managers': dataset.managers})
Beispiel #11
0
def model(name):
    dataset = get_dataset(name)
    etag_cache_keygen(dataset, private=dataset.private)
    return jsonify(dataset.model_data)
Beispiel #12
0
def structure(name):
    dataset = get_dataset(name)
    etag_cache_keygen(dataset, private=dataset.private)
    return jsonify({'fields': dataset.fields})
Beispiel #13
0
def structure(name):
    dataset = get_dataset(name)
    etag_cache_keygen(dataset, private=dataset.private)
    return jsonify({
        'fields': dataset.fields
    })
Beispiel #14
0
def view(name):
    dataset = get_dataset(name)
    etag_cache_keygen(dataset, private=dataset.private)
    return jsonify(dataset)
Beispiel #15
0
def managers(name):
    dataset = get_dataset(name)
    etag_cache_keygen(dataset, private=dataset.private)
    return jsonify({'managers': dataset.managers})
Beispiel #16
0
def model(name):
    dataset = get_dataset(name)
    etag_cache_keygen(dataset, private=dataset.private)
    return jsonify(dataset.model or {})