This repository was archived by the owner on Feb 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabituz.py
More file actions
44 lines (38 loc) · 1.2 KB
/
abituz.py
File metadata and controls
44 lines (38 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from app import create_app, db
from app.models import *
import click
app = create_app()
@app.shell_context_processor
def make_shell_context():
return {
'db': db, 'Application': Application,
'Student': Student, 'University': University,
'Faculty': Faculty, 'Program': Program
}
@app.cli.group()
def ds():
pass
@ds.command()
@click.option('--timer/--no-timer', 'loop', default=None, help='toggle periodical update checks')
@click.option('--interval', '-i', default=None, type=int, help='interval between updates')
@click.option('--debug/--no-debug', default=False, help='toggle debug output from update functions')
def update(interval, loop, debug):
"""Get updates from datasources"""
if interval == None:
interval = app.config['APP_UPDATE_SECS']
if loop == None:
loop = app.config['APP_UPDATE_TIMER']
if loop:
print('Starting supervisor')
from app.update import UpdateSupervisor
supervisor = UpdateSupervisor(interval, debug=debug)
else:
print('Starting single update')
from app.update import update_all
update_all(debug=debug)
@ds.command()
@click.argument('name')
def test(name):
"""Test update from datasource"""
from app.update import enabled_sources
enabled_sources[name](debug=True)