Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
plugin_dbui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Gitlab has been updated. More info
here
.
Show more breadcrumbs
w2pext
plugin_dbui
Commits
65b410ba
Commit
65b410ba
authored
14 years ago
by
Renaud Le Gac
Browse files
Options
Downloads
Patches
Plain Diff
Polish the documentation.
Raise an HTTP exception when a script does not exist.
parent
02211d81
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/plugin_dbui/helper.py
+18
-5
18 additions, 5 deletions
modules/plugin_dbui/helper.py
with
18 additions
and
5 deletions
modules/plugin_dbui/helper.py
+
18
−
5
View file @
65b410ba
...
...
@@ -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
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment