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
Show more breadcrumbs
w2pext
plugin_dbui
Commits
36314324
Commit
36314324
authored
8 years ago
by
LE GAC Renaud
Browse files
Options
Downloads
Patches
Plain Diff
Update helper.get_versions in order to handle all plugins.
parent
d17c105c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!36
Release 0.9.7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/plugin_dbui/helper.py
+46
-27
46 additions, 27 deletions
modules/plugin_dbui/helper.py
with
46 additions
and
27 deletions
modules/plugin_dbui/helper.py
+
46
−
27
View file @
36314324
...
...
@@ -573,40 +573,43 @@ def get_versions():
and its version identifier. The keys are ``code`` and ``version``
"""
ope
=
os
.
path
.
exists
opj
=
os
.
path
.
join
server_path
,
client_path
=
get_reference_paths
()
T
=
current
.
T
# matplotlib library
try
:
import
matplotlib
mpl
=
matplotlib
.
__version__
except
ImportError
:
mpl
=
current
.
T
(
'
not install
'
)
mpl
=
T
(
'
not install
'
)
# pandas library
try
:
import
pandas
pnd
=
pandas
.
__version__
except
ImportError
:
pnd
=
current
.
T
(
'
not install
'
)
pnd
=
T
(
'
not install
'
)
# plugin ace
ace
=
current
.
T
(
'
plugin
not install
'
)
path
=
o
s
.
path
.
join
(
server_path
,
'
static
'
,
'
plugin_ace
'
)
if
o
s
.
path
.
exists
(
path
):
ace
=
current
.
T
(
'
install
'
)
ace
=
T
(
'
not install
'
)
path
=
o
pj
(
server_path
,
'
static
'
,
'
plugin_ace
'
)
if
o
pe
(
path
):
ace
=
T
(
'
install
'
)
# plugin dbui
fn
=
o
s
.
path
.
join
(
server_path
,
'
static
'
,
'
plugin_dbui
'
,
'
src
'
,
'
Dbui.js
'
)
fn
=
o
pj
(
server_path
,
'
static
'
,
'
plugin_dbui
'
,
'
src
'
,
'
Dbui.js
'
)
with
open
(
fn
,
'
rb
'
)
as
fi
:
s
=
fi
.
read
()
m
=
re
.
match
(
"
(.+ version:
'
)([\w._-]*)(
'
.+)
"
,
s
,
re
.
DOTALL
)
dbui
=
m
.
group
(
2
)
# plugin Ext JS
extjs
=
current
.
T
(
'
plugin
not install
'
)
path
=
o
s
.
path
.
join
(
server_path
,
'
static
'
,
'
plugin_extjs
'
)
if
o
s
.
path
.
exists
(
path
):
fn
=
o
s
.
path
.
join
(
path
,
'
version.properties
'
)
extjs
=
T
(
'
not install
'
)
path
=
o
pj
(
server_path
,
'
static
'
,
'
plugin_extjs
'
)
if
o
pe
(
path
):
fn
=
o
pj
(
path
,
'
version.properties
'
)
with
open
(
fn
,
'
rb
'
)
as
fi
:
s
=
fi
.
read
()
...
...
@@ -615,13 +618,13 @@ def get_versions():
extjs
=
m
.
group
(
1
)
# plugin mathjax
mathjax
=
current
.
T
(
'
plugin
not install
'
)
path
=
o
s
.
path
.
join
(
server_path
,
'
static
'
,
'
plugin_mathjax
'
)
if
o
s
.
path
.
exists
(
path
):
fn
=
o
s
.
path
.
join
(
server_path
,
'
static
'
,
'
plugin_mathjax
'
,
'
MathJax.js
'
)
mathjax
=
T
(
'
not install
'
)
path
=
o
pj
(
server_path
,
'
static
'
,
'
plugin_mathjax
'
)
if
o
pe
(
path
):
fn
=
o
pj
(
server_path
,
'
static
'
,
'
plugin_mathjax
'
,
'
MathJax.js
'
)
with
open
(
fn
,
'
rb
'
)
as
fi
:
s
=
fi
.
read
()
...
...
@@ -629,6 +632,19 @@ def get_versions():
if
m
:
mathjax
=
m
.
group
(
1
)
# other plugins
plugins
=
[]
stdplgs
=
(
"
plugin_ace
"
,
"
plugin_dbui
"
,
"
plugin_extjs
"
,
"
plugin_mathjax
"
)
for
plg
in
os
.
listdir
(
opj
(
server_path
,
"
static
"
)):
if
plg
.
startswith
(
"
plugin
"
)
and
plg
not
in
stdplgs
:
path
=
opj
(
server_path
,
"
static
"
,
plg
,
"
VERSION
"
)
if
opj
(
path
):
with
open
(
opj
(
path
))
as
fi
:
plugins
.
append
(
dict
(
code
=
plg
,
version
=
fi
.
read
()))
else
:
plugins
.
append
(
dict
(
code
=
plg
,
version
=
T
(
'
install
'
)))
# web2py
web2py
=
''
val
=
current
.
request
.
env
.
web2py_version
...
...
@@ -638,17 +654,17 @@ def get_versions():
web2py
=
m
.
group
()
elif
isinstance
(
val
,
(
tuple
,
list
)):
li
=
[
str
(
el
)
for
el
in
val
if
isinstance
(
el
,
int
)]
li
=
[
str
(
plg
)
for
plg
in
val
if
isinstance
(
plg
,
int
)]
web2py
=
'
.
'
.
join
(
li
)
# version of the application
myapp
=
current
.
T
(
"
unknown
"
)
myapp
=
T
(
"
unknown
"
)
if
o
s
.
path
.
exists
(
VERSION
):
with
open
(
o
s
.
path
.
join
(
server_path
,
VERSION
))
as
fi
:
if
o
pe
(
VERSION
):
with
open
(
o
pj
(
server_path
,
VERSION
))
as
fi
:
myapp
=
fi
.
read
()
elif
o
s
.
path
.
exists
(
GIT
):
elif
o
pe
(
GIT
):
ref_path
=
os
.
getcwd
()
os
.
chdir
(
server_path
)
...
...
@@ -659,14 +675,17 @@ def get_versions():
# prepare the output
li
=
[
dict
(
code
=
"
web2py
"
,
version
=
web2py
),
dict
(
code
=
"
dbui
"
,
version
=
dbui
),
dict
(
code
=
"
extjs
"
,
version
=
extjs
),
dict
(
code
=
"
mathjax
"
,
version
=
mathjax
),
dict
(
code
=
"
ace
"
,
version
=
ace
),
dict
(
code
=
"
plugin_
dbui
"
,
version
=
dbui
),
dict
(
code
=
"
plugin_
extjs
"
,
version
=
extjs
),
dict
(
code
=
"
plugin_
mathjax
"
,
version
=
mathjax
),
dict
(
code
=
"
plugin_
ace
"
,
version
=
ace
),
dict
(
code
=
"
matplotlib
"
,
version
=
mpl
),
dict
(
code
=
"
pandas
"
,
version
=
pnd
),
dict
(
code
=
current
.
request
.
application
,
version
=
myapp
)]
li
.
extend
(
plugins
)
li
.
sort
()
return
li
...
...
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