Skip to content
Snippets Groups Projects
Commit 65b410ba authored by Renaud Le Gac's avatar Renaud Le Gac
Browse files

Polish the documentation.

Raise an HTTP exception when a script does not exist.
parent 02211d81
No related branches found
No related tags found
No related merge requests found
......@@ -55,6 +55,9 @@ def encode_field(*args):
def get_extjs_path(environment):
"""Helper function returning the local path of the ExtJS plugin.
It is defined with respect to the application directory.
The dictionary environment contains the keys request, response,
session, plugins, ....
Raise the exception HTTP(500) if the plugin is not found.
......@@ -73,19 +76,25 @@ def get_extjs_path(environment):
def get_reference_paths(environment):
"""Helper method returning a tuple with the server and the local paths.
The dictionary environment contains the keys request, response,
session, plugins, ....
"""
request = environment['request']
server_path = os.path.join('applications', request.application)
local_path = os.path.join(os.path.sep, request.application)
client_path = os.path.join(os.path.sep, request.application)
return (server_path, local_path)
return (server_path, client_path)
def get_script_path(environment):
"""Helper method returning the local path of the main script.
the local path is defined with respect to the application directory.
The dictionary environment contains the keys request, response,
session, plugins, ....
The script name can be set via the url.
......@@ -108,19 +117,23 @@ def get_script_path(environment):
script_dir = os.path.join(server_path, plugins.dbui.script_path)
if script not in os.listdir(script_dir):
return 'Request script "%s" does not exist !!!' % script
raise HTTP(500, 'Request script "%s" does not exist !!!' % script)
# return 'Request script "%s" does not exist !!!' % script
script = os.path.join(base, plugins.dbui.script_path, script)
return script
def get_language(T):
def get_language(environment):
"""Helper method returning the application language.
The result is compliant with the ExtJS file name.
The dictionary environment contains the keys request, response,
session, plugins, ....
"""
lg = T.accepted_language
lg = environment['T'].accepted_language
if len(lg) == 5 and lg[0:2] == lg[3:5]:
lg = lg[0:2]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment