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
15ee8e31
Commit
15ee8e31
authored
Dec 08, 2016
by
LE GAC Renaud
Browse files
Add the dbui.JSONEncoder to json.dumps in order to convert lazyT.
parent
c7a45b04
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
4 deletions
+12
-4
controllers/plugin_dbui.py
controllers/plugin_dbui.py
+2
-1
models/common_settings.py
models/common_settings.py
+1
-1
modules/plugin_dbui/navtree.py
modules/plugin_dbui/navtree.py
+9
-2
No files found.
controllers/plugin_dbui.py
View file @
15ee8e31
...
...
@@ -15,6 +15,7 @@
"""
import
json
import
os
import
plugin_dbui
as
dbui
from
gluon.tools
import
PluginManager
...
...
@@ -152,7 +153,7 @@ def dbui_conf():
# fill the javascript template
app
=
request
.
application
script
=
API
%
(
app
,
json
.
dumps
(
config
),
json
.
dumps
(
config
,
cls
=
dbui
.
JSONEncoder
),
debug
,
app
,
app
,
...
...
models/common_settings.py
View file @
15ee8e31
...
...
@@ -15,7 +15,7 @@ from gluon.tools import PluginManager
T
.
set_current_languages
(
"en"
,
"en-gb"
,
"en-us"
)
# mother tongue
T
.
force
(
"fr-fr"
)
# user language
T
.
lazy
=
Fals
e
# immediate translation
T
.
lazy
=
Tru
e
#
no
immediate translation
#.............................................................................
#
...
...
modules/plugin_dbui/navtree.py
View file @
15ee8e31
...
...
@@ -3,6 +3,9 @@
"""
import
json
import
locale
from
directsvc
import
JSONEncoder
from
gluon
import
current
...
...
@@ -39,7 +42,10 @@ class Node(object):
the widget associated to the leaf
"""
di
=
{
'cfg'
:
json
.
dumps
(
cfg
),
'leaf'
:
True
,
'text'
:
text
}
di
=
{
'cfg'
:
json
.
dumps
(
cfg
,
cls
=
JSONEncoder
),
'leaf'
:
True
,
'text'
:
text
}
self
.
children
.
append
(
di
)
def
add_children
(
self
,
leaves
,
func
=
None
,
hidden
=
[]):
...
...
@@ -67,7 +73,8 @@ class Node(object):
# according to local setting
cvt
=
{}
for
el
in
leaves
:
cvt
[
T
(
el
)]
=
el
# NOTE: str is required to force the translation when lazyT is on
cvt
[
str
(
T
(
el
))]
=
el
translate_leaves
=
cvt
.
keys
()
translate_leaves
.
sort
(
cmp
=
locale
.
strcoll
)
...
...
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