-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathmain.py
More file actions
32 lines (21 loc) · 1.1 KB
/
main.py
File metadata and controls
32 lines (21 loc) · 1.1 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
from ide import app, models, routes, modDBFunctions
from google.cloud import ndb
@app.shell_context_processor
def make_shell_context():
"""
In the flask shell use the `wc` decorator to call ndb methods like so:
@wc
def doSomething(foo, bar):
modDBFunctions.DumpUsers(User=foo, Bar=bar)
doSomething()
This will create an ndb context and then invoke the requested function with kwargs provided.
"""
project = routes.emulator and 'glowscript-dev' or None # use a fake project for local dev.
client = ndb.Client(project=project) # for user data, folders, and programs
import fs_utils as fsu
def doLoadPrograms(path):
loader = fsu.buildLoader(client, models.Program, ndb, 'localuser', 'testupdate', modDBFunctions)
fsu.LoadProgramVisitor(path, loader)
return {'app': app, 'User': models.User, 'Folder':models.Folder, 'Program':models.Program,
'Setting':models.Setting,'ndb':ndb, 'models':models, 'routes':routes, 'project':project,
'client':client, 'modDBFunctions':modDBFunctions, 'doLoadPrograms':doLoadPrograms}