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
fd76d546
Commit
fd76d546
authored
Dec 06, 2019
by
LE GAC Renaud
Browse files
Update helper to use Path in get_file_paths.
parent
b5eeed51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
15 deletions
+19
-15
modules/plugin_dbui/helper.py
modules/plugin_dbui/helper.py
+19
-15
No files found.
modules/plugin_dbui/helper.py
View file @
fd76d546
...
...
@@ -294,33 +294,37 @@ def get_file_paths(path, ext=None, alpha=True):
alpha (bool): sort the paths in alphabetic order
Returns:
list:
local paths for all selected files.
list or string:
* paths for all selected files,
* absolute path with respect to application
* for example: /myapp/static/myapp-min.js
"""
li
=
[]
if
path
is
None
:
return
li
return
[]
server_path
,
client_path
=
get_reference_paths
()
lst
=
[]
application
=
current
.
request
.
application
app_path
=
Path
(
"applications"
,
application
)
for
el
in
as_list
(
path
):
p
=
os
.
path
.
join
(
server
_path
,
el
)
p
=
app
_path
/
el
if
os
.
path
.
isfile
(
p
):
if
ext
and
(
not
el
.
endswith
(
ext
)
)
:
if
p
.
is
_
file
():
if
(
ext
is
not
None
)
and
(
p
.
suffix
!=
ext
):
continue
l
i
.
append
(
os
.
path
.
join
(
client_path
,
el
))
l
st
.
append
(
Path
(
"/"
,
application
,
el
))
elif
os
.
path
.
isdir
(
p
):
for
file
name
in
os
.
list
dir
(
p
):
pfile
=
os
.
path
.
join
(
el
,
filename
)
l
i
.
extend
(
get_file_paths
(
pfile
,
ext
,
alpha
))
elif
p
.
is
_
dir
():
for
p
file
in
p
.
iter
dir
():
new_path
=
str
(
pfile
.
relative_to
(
app_path
)
)
l
st
.
extend
(
get_file_paths
(
new_path
,
ext
,
alpha
))
lst
=
[
str
(
el
)
for
el
in
lst
]
if
alpha
:
l
i
.
sort
()
l
st
.
sort
()
return
l
i
return
l
st
def
get_foreign_field
(
field
):
...
...
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