📣 An issue occured with the embedded container registry on October 25 2021, between 10:30 and 12:10 (UTC+2). Any persisting issues should be reported to CC-IN2P3 Support. 🐛

Commit 1412c378 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update helper to use Path in get_plugin_path.

parent fd76d546
......@@ -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
......
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