-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.py
47 lines (39 loc) · 1.35 KB
/
commands.py
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
45
46
47
# Secure
import getopt
from play.utils import *
MODULE = "gae-secure"
COMMANDS = ["secure:", "secure:ov", "secure:override"]
HELP = {
"secure:": "Show help for the secure module",
"secure:override": "Override the CSS, login or layout"
}
def execute(**kargs):
command = kargs.get("command")
app = kargs.get("app")
args = kargs.get("args")
env = kargs.get("env")
if command == 'secure:':
print "~ Use: --css to override the Secure css"
print "~ --login to override the login page"
print "~ --layout to override the login layout page"
print "~ "
return
try:
optlist, args2 = getopt.getopt(args, '', ['css', 'login', 'layout'])
for o, a in optlist:
if o == '--css':
app.override('public/stylesheets/secure.css', 'public/stylesheets/secure.css')
print "~ "
return
if o == '--login':
app.override('app/views/Secure/login.html', 'app/views/Secure/login.html')
print "~ "
return
if o == '--layout':
app.override('app/views/Secure/layout.html', 'app/views/Secure/layout.html')
print "~ "
return
except getopt.GetoptError, err:
print "~ %s" % str(err)
print "~ "
sys.exit(-1)