Completed
Push — master ( bb54e7...315dbc )
by Chris
01:27
created

_can_make_global()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
c 0
b 0
f 0
dl 0
loc 2
rs 10
1
"""This is your typical app, demonstrating usage."""
2
3
import os
4
5
from flask_jsondash.charts_builder import charts
6
7
from flask import (
8
    Flask,
9
    session,
10
)
11
12
app = Flask(__name__)
13
app.config['SECRET_KEY'] = 'NOTSECURELOL'
14
app.config.update(
15
    JSONDASH_FILTERUSERS=False,
16
    JSONDASH_GLOBALDASH=False,
17
    JSONDASH_GLOBAL_USER='global',
18
)
19
app.debug = True
20
app.register_blueprint(charts)
21
22
23
def _can_edit_global():
24
    return True
25
26
27
def _can_delete():
28
    return True
29
30
31
def _can_clone():
32
    return True
33
34
35
def _get_username():
36
    return 'anonymous'
37
38
39
# Config examples.
40
app.config['JSONDASH'] = dict(
41
    metadata=dict(
42
        created_by=_get_username,
43
        username=_get_username,
44
    ),
45
    static=dict(
46
        js_path='js/vendor/',
47
        css_path='css/vendor/',
48
    ),
49
    auth=dict(
50
        edit_global=_can_edit_global,
51
        clone=_can_clone,
52
        delete=_can_delete,
53
    )
54
)
55
56
57
@app.route('/', methods=['GET'])
58
def index():
59
    """Sample index."""
60
    return '<a href="/charts">Visit the charts blueprint.</a>'
61
62
63
if __name__ == '__main__':
64
    PORT = int(os.getenv('PORT', 5002))
65
    app.run(debug=True, port=PORT)
66