From 7f48e9312d35ffb34cfb7ae5d25e7cb2a96c5bbd Mon Sep 17 00:00:00 2001 From: Renaud Le Gac <renaud.legac@free.fr> Date: Sat, 31 Oct 2009 18:06:13 +0000 Subject: [PATCH] Remove the test option and replace it by the script option. --- controllers/default.py | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/controllers/default.py b/controllers/default.py index 9855f00e..b45d3475 100644 --- a/controllers/default.py +++ b/controllers/default.py @@ -25,10 +25,11 @@ def index(): debug activate the debug mode on the server side. - test - launch the javascript apptest.js instead of the main - application scripts appmain.js. Useful to develop new - features and components in the application framework. + script foo + by default the javascript appmain.js is launch. + this option will launch the specified script, i.e. foo.js. + Useful to develop new features and components in the + application framework. EXAMPLES @@ -37,18 +38,25 @@ def index(): """ - # options - for opt in ["debug", "test"]: - exec("%s = False" % opt) - if opt in request.get_vars: - exec("%s = True" % opt) - + # option debug + debug = False + if "debug" in request.get_vars: + debug = True + + # option script + script = "appmain" + if "script" in request.get_vars: + script = request.get_vars.script + + print "OPTION DEBUG:", debug + print "OPTION SCRIPT:", script + # application path base = os.path.join(os.path.sep, request.application) # css files csslibs = [os.path.join(base, 'static', 'extjs', 'resources', 'css', 'ext-all.css'), - os.path.join(base, 'static', 'appjs', 'icons.css')] + os.path.join(base, 'static', 'extjs', 'examples', 'shared', 'icons', 'silk.css')] # javascript librairies if debug: @@ -69,10 +77,7 @@ def index(): os.path.join(base, 'static', 'appjs', 'appmgr.js')] # main application script - if test: - applibs.append(os.path.join(base, 'static', 'apptest.js')) - else: - applibs.append(os.path.join(base, 'static', 'appmain.js')) + applibs.append(os.path.join(base, 'static', '%s.js' % script)) # page view response.view = "applayout.html" -- GitLab