示例#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'])
    })
示例#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'])
    })
示例#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)
    })
示例#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)
示例#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)
示例#6
0
文件: home.py 项目: leowmjw/spendb
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)
示例#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)
示例#8
0
文件: session.py 项目: leowmjw/spendb
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)})
示例#9
0
文件: dataset.py 项目: leowmjw/spendb
def view(name):
    dataset = get_dataset(name)
    etag_cache_keygen(dataset, private=dataset.private)
    return jsonify(dataset)
示例#10
0
文件: dataset.py 项目: leowmjw/spendb
def managers(name):
    dataset = get_dataset(name)
    etag_cache_keygen(dataset, private=dataset.private)
    return jsonify({'managers': dataset.managers})
示例#11
0
文件: dataset.py 项目: leowmjw/spendb
def model(name):
    dataset = get_dataset(name)
    etag_cache_keygen(dataset, private=dataset.private)
    return jsonify(dataset.model_data)
示例#12
0
文件: dataset.py 项目: leowmjw/spendb
def structure(name):
    dataset = get_dataset(name)
    etag_cache_keygen(dataset, private=dataset.private)
    return jsonify({'fields': dataset.fields})
示例#13
0
def structure(name):
    dataset = get_dataset(name)
    etag_cache_keygen(dataset, private=dataset.private)
    return jsonify({
        'fields': dataset.fields
    })
示例#14
0
def view(name):
    dataset = get_dataset(name)
    etag_cache_keygen(dataset, private=dataset.private)
    return jsonify(dataset)
示例#15
0
def managers(name):
    dataset = get_dataset(name)
    etag_cache_keygen(dataset, private=dataset.private)
    return jsonify({'managers': dataset.managers})
示例#16
0
def model(name):
    dataset = get_dataset(name)
    etag_cache_keygen(dataset, private=dataset.private)
    return jsonify(dataset.model or {})