Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vidjil
vidjil
Commits
20ac386e
Commit
20ac386e
authored
May 23, 2017
by
Mathieu Giraud
Browse files
Merge branch 'feature-s/composite_filetype_jstree' into 'dev'
Feature s/composite filetype jstree See merge request
!45
parents
1fd597c0
24e9977a
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/web2py/applications/vidjil/controllers/file.py
View file @
20ac386e
...
...
@@ -644,6 +644,10 @@ def restart_pre_process():
res
=
schedule_pre_process
(
sequence_file
.
id
,
pre_process
.
id
)
return
gluon
.
contrib
.
simplejson
.
dumps
(
res
,
separators
=
(
','
,
':'
))
def
match_filetype
(
filename
,
extension
):
ext_len
=
len
(
extension
)
return
ext_len
==
0
||
filename
[
-
ext_len
:]
==
extension
def
filesystem
():
json
=
[]
id
=
""
if
request
.
vars
[
"node"
]
is
None
else
request
.
vars
[
"node"
]
+
'/'
...
...
@@ -652,7 +656,11 @@ def filesystem():
else
:
root_folder
=
defs
.
FILE_SOURCE
+
id
for
idx
,
f
in
enumerate
(
os
.
listdir
(
root_folder
)):
correct_type
=
f
.
split
(
'.'
)[
-
1
]
in
defs
.
FILE_TYPES
correct_type
=
False
for
ext
in
defs
.
FILE_TYPES
:
correct_type
=
match_filetype
(
f
,
ext
)
if
correct_type
:
break
is_dir
=
os
.
path
.
isdir
(
root_folder
+
f
)
if
correct_type
or
is_dir
:
json_node
=
jstree
.
Node
(
f
,
id
+
f
).
jsonData
()
...
...
Write
Preview
Supports
Markdown
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