|
a/hwctl/switcherapp.py |
|
b/hwctl/switcherapp.py |
|
... |
|
... |
11 |
import sys
|
11 |
import sys
|
12 |
import urllib
|
12 |
import urllib
|
13 |
|
13 |
|
14 |
import bottle
|
14 |
import bottle
|
15 |
|
15 |
|
16 |
import rclconfig
|
|
|
17 |
import swgpio
|
16 |
import swgpio
|
18 |
|
17 |
|
19 |
# Return first value in list which is not in 'invalid'
|
18 |
# Return first value in list which is not in 'invalid'
|
20 |
# list. E.g. first non-None. Typ. usage is for returning dflt value if
|
19 |
# list. E.g. first non-None. Typ. usage is for returning dflt value if
|
21 |
# query result as first element is None
|
20 |
# query result as first element is None
|
22 |
def choose(lst, invalid=[None]):
|
21 |
def choose(lst, invalid=[None]):
|
23 |
for value in lst:
|
22 |
for value in lst:
|
24 |
if value not in invalid:
|
23 |
if value not in invalid:
|
25 |
return value
|
24 |
return value
|
26 |
|
25 |
|
27 |
def get_config():
|
|
|
28 |
config = {}
|
|
|
29 |
# get useful things from our configuration
|
|
|
30 |
fconfig = rclconfig.ConfSimple('appconfig')
|
|
|
31 |
return config
|
|
|
32 |
|
|
|
33 |
def debug(x):
|
26 |
def debug(x):
|
34 |
print("%s" % x, file = sys.stderr)
|
27 |
print("%s" % x, file = sys.stderr)
|
35 |
|
|
|
36 |
|
28 |
|
37 |
@bottle.route('/static/:path#.+#')
|
29 |
@bottle.route('/static/:path#.+#')
|
38 |
def server_static(path):
|
30 |
def server_static(path):
|
39 |
return bottle.static_file(path, root='./static')
|
31 |
return bottle.static_file(path, root='./static')
|
40 |
|
32 |
|