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
aa43f37f
Commit
aa43f37f
authored
Dec 06, 2019
by
LE GAC Renaud
Browse files
Update controller documentations_table to use Path.
parent
08cd6fe9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
40 deletions
+53
-40
controllers/plugin_dbui.py
controllers/plugin_dbui.py
+53
-40
No files found.
controllers/plugin_dbui.py
View file @
aa43f37f
...
...
@@ -16,8 +16,10 @@
import
json
import
os
from
gluon.tools
import
PluginManager
API
=
"""
Dbui.csvUrl = "/%s/plugin_dbui/csv";
Dbui.config = %s;
...
...
@@ -32,10 +34,13 @@ Dbui.REMOTE_API = {
def
about
():
fn
=
os
.
path
.
join
(
"applications"
,
request
.
application
,
PluginManager
(
"dbui"
).
dbui
.
app_about
)
return
open
(
fn
,
"rb"
).
read
()
from
pathlib
import
Path
path
=
Path
(
"applications"
,
request
.
application
,
PluginManager
(
"dbui"
).
dbui
.
app_about
)
return
path
.
read_text
()
def
call
():
...
...
@@ -171,40 +176,45 @@ def documentations_table():
configuration for the documentation and for the source code.
"""
from
plugin_dbui
import
get_reference_paths
,
Store
from
pathlib
import
Path
from
plugin_dbui
import
Store
def
path_exists
(
x
):
return
x
and
os
.
path
.
exists
(
os
.
path
.
join
(
apath
,
x
))
def
f
(
x
):
return
x
.
replace
(
"static/"
,
""
)
# alias
a
=
'<a href="{}" target="_blank">{}</a>'
application
=
request
.
application
plugin
=
PluginManager
(
"dbui"
).
dbui
# alias
a
=
'<a href="%s" target="_blank">%s</a>'
trDb
=
T
(
"Data base scheme"
)
trDev
=
T
(
"Documentation for developers"
)
trJS
=
T
(
"Javascript API"
)
trPy
=
T
(
"Python API"
)
apath
,
lpath
=
get_reference_paths
()
# main paths
apath
=
Path
(
"applications"
,
application
)
static
=
apath
/
"static"
# documentation of the application
userdoc
=
""
path_db_schema
=
plugin
.
app_db_schema
if
path_exists
(
path_db_schema
):
userdoc
=
a
%
(
URL
(
"static"
,
f
(
path_db_schema
)),
T
(
"Data base scheme"
))
if
plugin
.
app_db_schema
is
not
None
:
path_db_schema
=
apath
/
plugin
.
app_db_schema
if
path_db_schema
.
exists
():
fpath
=
str
(
path_db_schema
.
relative_to
(
static
))
userdoc
=
a
.
format
(
URL
(
"static"
,
fpath
),
trDb
)
pydoc
=
""
path_html_api
=
plugin
.
app_html_api
if
path_exists
(
path_html_api
):
pydoc
=
a
%
(
URL
(
"static"
,
f
(
path_html_api
)),
trPy
)
if
plugin
.
app_html_api
is
not
None
:
path_html_api
=
apath
/
plugin
.
app_html_api
if
path_html_api
.
exists
():
fpath
=
str
(
path_html_api
.
relative_to
(
static
))
pydoc
=
a
.
format
(
URL
(
"static"
,
fpath
),
trPy
)
jsdoc
=
""
path_html_jsduck
=
plugin
.
app_html_jsduck
if
path_exists
(
path_html_jsduck
):
jsdoc
=
a
%
(
URL
(
"static"
,
f
(
path_html_jsduck
)),
trJS
)
if
plugin
.
app_html_jsduck
is
not
None
:
path_html_jsduck
=
apath
/
plugin
.
app_html_jsduck
if
path_html_jsduck
.
exists
():
fpath
=
str
(
path_html_jsduck
.
relative_to
(
static
))
jsdoc
=
a
.
format
(
URL
(
"static"
,
fpath
),
trJS
)
# configuration of the Ext.data.Store for the documentation
cfg
=
Store
()
...
...
@@ -222,39 +232,42 @@ def documentations_table():
javascript
=
jsdoc
)
r2
=
dict
(
code
=
a
%
(
"https://marprod.in2p3.fr/plugin_dbui_book"
,
"plugin_dbui"
),
code
=
a
.
format
(
"https://marprod.in2p3.fr/plugin_dbui_book"
,
"plugin_dbui"
),
developer
=
a
%
(
URL
(
"static"
,
"plugin_dbui/docs/reference/index.html"
),
trDev
),
developer
=
a
.
format
(
URL
(
"static"
,
"plugin_dbui/docs/reference/index.html"
),
trDev
),
python
=
a
%
(
URL
(
"static"
,
"plugin_dbui/docs/api/index.html"
),
trPy
),
python
=
a
.
format
(
URL
(
"static"
,
"plugin_dbui/docs/api/index.html"
),
trPy
),
javascript
=
a
%
(
URL
(
"static"
,
"plugin_dbui/docs/jsduck/index.html"
),
trJS
))
javascript
=
a
.
format
(
URL
(
"static"
,
"plugin_dbui/docs/jsduck/index.html"
),
trJS
))
r3
=
dict
(
code
=
a
%
(
"http://web2py.com/"
,
"Web2py"
),
developer
=
a
%
(
"http://web2py.com/book"
,
trDev
),
python
=
a
%
(
"http://web2py.readthedocs.org/en/latest/"
,
trPy
),
code
=
a
.
format
(
"http://web2py.com/"
,
"Web2py"
),
developer
=
a
.
format
(
"http://web2py.com/book"
,
trDev
),
python
=
a
.
format
(
"http://web2py.readthedocs.org/en/latest/"
,
trPy
),
javascript
=
""
)
r4
=
dict
(
code
=
a
%
(
"http://www.sencha.com/products/extjs/"
,
"Ext JS"
),
code
=
a
.
format
(
"http://www.sencha.com/products/extjs/"
,
"Ext JS"
),
developer
=
""
,
python
=
""
,
javascript
=
a
%
(
"http://docs.sencha.com/extjs/6.0.1-classic/"
,
trJS
))
javascript
=
a
.
format
(
"http://docs.sencha.com/extjs/6.0.1-classic/"
,
trJS
))
r5
=
dict
(
code
=
a
%
(
"http://www.mathjax.org/"
,
"MathJax"
),
code
=
a
.
format
(
"http://www.mathjax.org/"
,
"MathJax"
),
developer
=
""
,
python
=
""
,
javascript
=
a
%
(
"http://docs.mathjax.org/"
,
trJS
))
javascript
=
a
.
format
(
"http://docs.mathjax.org/"
,
trJS
))
r6
=
dict
(
code
=
a
%
(
"http://ace.c9.io/#nav=about"
,
"Ace"
),
code
=
a
.
format
(
"http://ace.c9.io/#nav=about"
,
"Ace"
),
developer
=
""
,
python
=
""
,
javascript
=
a
%
(
"http://ace.c9.io/#nav=api"
,
trJS
))
javascript
=
a
.
format
(
"http://ace.c9.io/#nav=api"
,
trJS
))
cfg
.
data
=
[
r1
,
r2
,
r3
,
r4
,
r5
,
r6
]
...
...
@@ -268,7 +281,7 @@ def documentations_table():
src
=
""
if
plugin
.
app_git
:
src
=
"<em>git clone
%s</em>"
%
plugin
.
app_git
src
=
f
"<em>git clone
{
plugin
.
app_git
}
</em>"
r1
=
dict
(
code
=
request
.
application
,
source
=
src
)
...
...
@@ -285,7 +298,7 @@ def documentations_table():
code
=
"Ext JS"
,
source
=
"<em>Download from the Ext JS web site. </em><br>"
"<em>It is also available in the local directory: "
"%s
/static/plugin_extjs/src</em>"
%
request
.
application
)
f
"
{
request
.
application
}
/static/plugin_extjs/src</em>"
)
r5
=
dict
(
code
=
"MathJax"
,
...
...
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