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
15ee8e31
Commit
15ee8e31
authored
8 years ago
by
LE GAC Renaud
Browse files
Options
Downloads
Patches
Plain Diff
Add the dbui.JSONEncoder to json.dumps in order to convert lazyT.
parent
c7a45b04
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!36
Release 0.9.7
,
!35
Resolve "fix crash when the lazy translation is activated"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
controllers/plugin_dbui.py
+2
-1
2 additions, 1 deletion
controllers/plugin_dbui.py
models/common_settings.py
+1
-1
1 addition, 1 deletion
models/common_settings.py
modules/plugin_dbui/navtree.py
+9
-2
9 additions, 2 deletions
modules/plugin_dbui/navtree.py
with
12 additions
and
4 deletions
controllers/plugin_dbui.py
+
2
−
1
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
,
...
...
This diff is collapsed.
Click to expand it.
models/common_settings.py
+
1
−
1
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
#.............................................................................
#
...
...
This diff is collapsed.
Click to expand it.
modules/plugin_dbui/navtree.py
+
9
−
2
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
)
...
...
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