Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathmain.py
More file actions
Latest commit
32 lines (21 loc) · 1.1 KB
/
Copy pathmain.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
fromideimportapp, models, routes, modDBFunctions
fromgoogle.cloudimportndb
@app.shell_context_processor
defmake_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.emulatorand'glowscript-dev'orNone# use a fake project for local dev.
client=ndb.Client(project=project) # for user data, folders, and programs
importfs_utilsasfsu
defdoLoadPrograms(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}