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
e4423172
Commit
e4423172
authored
13 years ago
by
Renaud Le Gac
Browse files
Options
Downloads
Patches
Plain Diff
Replace the function get_extjs_path by get_plugin_path.
parent
a3f6f096
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/plugin_dbui/__init__.py
+3
-3
3 additions, 3 deletions
modules/plugin_dbui/__init__.py
modules/plugin_dbui/helper.py
+19
-13
19 additions, 13 deletions
modules/plugin_dbui/helper.py
with
22 additions
and
16 deletions
modules/plugin_dbui/__init__.py
+
3
−
3
View file @
e4423172
...
...
@@ -9,9 +9,9 @@ from fieldmodifier import FieldModifier
from
foreignfield
import
ForeignField
from
formmodifier
import
configure_forms
,
FormModifier
from
gridmodifier
import
configure_grids
,
GridModifier
from
helper
import
(
get_
extjs_path
,
get_
js_files
,
get_
language
,
from
helper
import
(
get_
js_files
,
get_
language
,
get_
plugin_path
,
get_reference_paths
,
get_script_path
)
from
mapper
import
map_default
,
map_tabpanel
...
...
This diff is collapsed.
Click to expand it.
modules/plugin_dbui/helper.py
+
19
−
13
View file @
e4423172
...
...
@@ -52,28 +52,34 @@ def encode_field(*args):
return
''
.
join
([
el
[
0
].
upper
()
+
el
[
1
:].
lower
()
for
el
in
args
if
len
(
el
)])
def
get_extjs_path
(
environment
):
"""
Helper function returning the local path of the ExtJS plugin.
It is defined with respect to the application directory.
def
get_plugin_path
(
environment
,
plugin_name
):
"""
Helper function returning the local path of the plugin name:
plugin_extjs, plugin_mathjax, ...
The local path defined with respect to the application directory.
The function return the path of the first directory starting with
plugin_name. It is useful to handle plugin with a version number
like plugin_extjs_3.3.2.
The dictionary environment contains the keys request, response,
session, plugins, ....
Raise the exception HTTP(500) if the plugin is not found.
"""
application
=
environment
[
'
request
'
].
application
# check the absolute path on the server
server_path
=
os
.
path
.
join
(
'
applications
'
,
application
)
path
=
os
.
path
.
join
(
server_path
,
'
static
'
,
'
plugin_extjs
'
)
if
not
os
.
path
.
exists
(
path
):
raise
HTTP
(
500
,
'
The plugin ExtJS is not install !
'
)
server_path
,
client_path
=
get_reference_paths
(
environment
)
# return the local path
return
os
.
path
.
join
(
os
.
path
.
sep
,
application
,
'
static
'
,
'
plugin_extjs
'
)
# look for the full name of the plugin directory
p_static
=
os
.
path
.
join
(
server_path
,
'
static
'
)
for
el
in
os
.
listdir
(
p_static
):
if
os
.
path
.
isdir
(
os
.
path
.
join
(
p_static
,
el
)):
if
el
.
startswith
(
plugin_name
):
return
os
.
path
.
join
(
client_path
,
'
static
'
,
el
)
# Nothing found
raise
HTTP
(
500
,
'
The plugin %s is not install !
'
%
plugin_name
)
def
get_js_files
(
server_path
,
client_path
,
directory
):
"""
Return a list of javascript files stored in the directory.
The alphabetic order is preserved.
...
...
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