Commit 4cab7bc1 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Remove the plugin_dbui/debug controller.

parent 4fd821b0
......@@ -8,12 +8,7 @@ def index():
"""Main Controller to run the application.
"""
if 'debug' in request.vars:
del request.vars['debug']
url = URL('plugin_dbui', 'debug', args=request.args, vars=request.vars)
else:
url = URL('plugin_dbui', 'index', args=request.args, vars=request.vars)
url = URL('plugin_dbui', 'index', args=request.args, vars=request.vars)
return redirect(url)
......
......@@ -161,83 +161,6 @@ def dbui_conf():
return script
def debug():
"""Action to run the plugin in debug mode.
Load dynamically the javascript source code for all libraries.
Active the debug mode on the server and client side.
EXAMPLES
http://localhost:8000/myapp/plugin_dbui/debug
http://localhost:8000/myapp/plugin_dbui/debug?script=foo
URL OPTIONS
script
run the javascript foo in the framework defined by the plugin.
The scripts are stored in the directory defined by the plugin
configuration app_script_dir.
"""
from plugin_dbui import get_file_paths, get_script_path
lst = []
plugin = PluginManager("dbui").dbui
plugins_paths = plugin.plugins_paths
# css
for plg in plugins_paths:
path =plugins_paths[plg]["css"]
if path is not None:
lst.extend(get_file_paths(path, ext='.css'))
lst.extend(get_file_paths(plugin.app_css, ext='.css'))
# debug version of the javascript libraries
for plg in plugins_paths:
path =plugins_paths[plg]["debug"]
if path is not None:
if plg == "extjs":
lst.extend(get_file_paths(path, ext='.js', alpha=False))
else:
lst.extend(get_file_paths(path, ext='.js'))
lst.extend(get_file_paths(plugin.app_debug, ext='.js'))
# language
for plg in plugins_paths:
path =plugins_paths[plg]["lg"]
if path is not None:
lst.extend(get_file_paths(path, ext='.js'))
lst.extend(get_file_paths(plugin.app_lg, ext='.js'))
# URL for the dbui configuration activating the debug
# mode on the client side
lst.append(plugin.dbui_conf_debug)
# main script which can be defined in many different ways
pscript = get_script_path(plugin)
lst.append(pscript)
# switch ON the debug mode on the server side
session.debug = True
# select the view
response.view = 'plugin_dbui/index.html'
# convert path into HTML
fwlib = ""
for el in lst:
if el.endswith(".css"):
fwlib += '<link rel="stylesheet" type="text/css" href="%s"/>\n\t\t' % el
else:
fwlib +='<script type="text/javascript" src="%s"></script>\n\t\t' %el
return dict(fwlib=fwlib)
def documentations():
"""Return the Ext.data.Array configuration for the documentation
and for the source code.
......@@ -355,10 +278,15 @@ def index():
EXAMPLES
http://localhost:8000/myapp/plugin_dbui
http://localhost:8000/myapp/plugin_dbui?debug
http://localhost:8000/myapp/plugin_dbui?script=foo
URL OPTIONS
debug
Load dynamically the javascript source code for all libraries.
Active the debug mode on the server and client side.
script
run the javascript foo in the framework defined by the plugin.
The scripts are stored in the directory defined by the plugin
......@@ -371,6 +299,8 @@ def index():
plugin = PluginManager("dbui").dbui
plugins_paths = plugin.plugins_paths
is_debug = "debug" in request.vars
# css
for plg in plugins_paths:
path =plugins_paths[plg]["css"]
......@@ -379,16 +309,20 @@ def index():
lst.extend(get_file_paths(plugin.app_css, ext='.css'))
# compressed version of the javascript libraries
# javascript libraries
# depend on the debug mode either minified or full version
key = ("debug" if is_debug else "libmin")
for plg in plugins_paths:
path =plugins_paths[plg]["libmin"]
path =plugins_paths[plg][key]
if path is not None:
if plg == "extjs":
lst.extend(get_file_paths(path, ext='.js', alpha=False))
else:
lst.extend(get_file_paths(path, ext='.js'))
lst.extend(get_file_paths(plugin.app_libmin, ext='.js'))
path = (plugin.app_debug if is_debug else plugin.app_libmin)
lst.extend(get_file_paths(path, ext='.js'))
# language
for plg in plugins_paths:
......@@ -399,14 +333,15 @@ def index():
lst.extend(get_file_paths(plugin.app_lg, ext='.js'))
# URL for dbui configuration script
lst.append(plugin.dbui_conf)
path = (plugin.dbui_conf_debug if is_debug else plugin.dbui_conf)
lst.append(path)
# main script which can be defined in many different ways
pscript = get_script_path(plugin)
lst.append(pscript)
# switch off the debug mode on the server side
session.debug = False
# switch on/off the debug mode on the server side
session.debug = is_debug
# convert path into HTML
fwlib = ""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment