Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
w2pext
plugin_dbui
Commits
1412c378
Commit
1412c378
authored
Dec 06, 2019
by
LE GAC Renaud
Browse files
Update helper to use Path in get_plugin_path.
parent
fd76d546
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
modules/plugin_dbui/helper.py
modules/plugin_dbui/helper.py
+9
-7
No files found.
modules/plugin_dbui/helper.py
View file @
1412c378
...
...
@@ -453,18 +453,20 @@ def get_plugin_path(plugin_name):
Returns:
str:
* the path of the first directory starting with ``plugin_name``.
* the local path is relative to the application directory.
* absolute path with respect to application
* for example: /myapp/static/plugin_foo
* ``None`` if the plugin is not found.
"""
server_path
,
client_path
=
get_reference_paths
()
application
=
current
.
request
.
application
app_path
=
Path
(
"applications"
,
application
)
# 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
)
p_static
=
app
_path
/
"static"
for
el
in
p_static
.
iterdir
(
):
if
el
.
is
_
dir
():
if
el
.
name
==
plugin_name
:
return
str
(
Path
(
"/"
,
application
,
"static"
,
plugin_name
)
)
# Nothing found
return
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment