Commit 2003ca58 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Activate lazy translation.

parent ef29272b
......@@ -4,7 +4,7 @@
import json
import re
from plugin_dbui import inline_alert, Selector
from plugin_dbui import inline_alert, JSONEncoder, Selector
from pydal.helpers.methods import smart_query
from reporting_tools import get_converter, repr_team_project
......@@ -126,6 +126,6 @@ def index():
if cfg['data'][i][0] in cvt_labels:
cfg['data'][i][0] = cvt_labels[cfg['data'][i][0]]
return dict(cfg_store=json.dumps(cfg),
return dict(cfg_store=json.dumps(cfg, cls=JSONEncoder),
team_project=repr_team_project(db, selector),
selector=selector)
......@@ -10,10 +10,11 @@ from gluon.storage import Storage
from harvest_tools import DRY_RUN
from invenio_tools import CdsException, load_record, Marc12Exception
from plugin_dbui import (CALLBACK_ERRORS,
inline_alert,
is_foreign_field,
get_foreign_field,
get_id,
inline_alert,
is_foreign_field,
JSONEncoder,
Selector,
to_fields)
......@@ -182,7 +183,10 @@ def check_validate():
return dict(counters=counters,
logs=logs,
publications_fields=json.dumps(to_fields(db.publications)),
publications_fields=json.dumps(
to_fields(db.publications), cls=JSONEncoder),
selector=selector)
......
......@@ -74,7 +74,7 @@ current.auth = auth
T.set_current_languages("en", "en-gb", "en-us") # mother tongue
T.force("fr-fr") # user language
T.lazy = False # immediate translation
T.lazy = True # immediate translation
# ............................................................................
#
......
......@@ -309,9 +309,9 @@ class ViewportUi(object):
timeout=ONE_HOUR)
add_child = node.add_child
add_child(T("run a free harvester"), free_panel)
add_child(T("run a harvester"), harvester_panel)
add_child(T("run all harvesters"), run_all_panel)
add_child(T("run a free harvester", lazy=False), free_panel)
add_child(T("run a harvester", lazy=False), harvester_panel)
add_child(T("run all harvesters", lazy=False), run_all_panel)
node.sort_children()
......@@ -343,7 +343,7 @@ class ViewportUi(object):
loader = dict(
autoLoad=True,
renderer="html",
url=URL("plugin_dbui", "documentations_table"))
url=URL("plugin_dbui", "documentations_list"))
doc_panel = Panel(
loader=loader,
......@@ -479,15 +479,15 @@ class ViewportUi(object):
baseUrl=URL("harvest", "insert_marcxml"))
add_child = node.add_child
add_child(T("extract authors"), author_panel)
add_child(T("extract authors", lazy=False), author_panel)
if session.role == ADMIN:
add_child(T("check and validate"), check_panel)
add_child(T("check and validate", lazy=False), check_panel)
else:
add_child(T("check"), check_panel)
add_child(T("check", lazy=False), check_panel)
add_child(T("edit and insert"), edit_panel)
add_child(T("insert MARCXML"), marc12_panel)
add_child(T("edit and insert", lazy=False), edit_panel)
add_child(T("insert MARCXML", lazy=False), marc12_panel)
node.sort_children()
......
......@@ -7,12 +7,13 @@
#
#--------------------------------------------------------------------------
import json
from plugin_dbui import JSONEncoder
}}
<script type="text/javascript">
var cfg = {{=XML(json.dumps(cfg))}},
values = {{=XML(json.dumps(values))}},
var cfg = {{=XML(json.dumps(cfg, cls=JSONEncoder))}},
values = {{=XML(json.dumps(values, cls=JSONEncoder))}},
form, win;
// create the form and load values
......
......@@ -17,9 +17,10 @@
# - export python variable to the javascript
#
#--------------------------------------------------------------------------
import gluon
import json
from datetime import datetime
from gluon.storage import Storage
from plugin_dbui import JSONEncoder
#
# configure the Ext.data.Array for the statistics
......@@ -64,7 +65,7 @@
cfg['data'].append(stat)
pass
cfg_statStore = json.dumps(cfg)
cfg_statStore = json.dumps(cfg, cls=JSONEncoder)
#
# configure the Ext.data.Array for the logs
......@@ -87,7 +88,7 @@
for row in logs:
cfg['data'].append([row.action,
row.collection,
json.dumps(row.harvester),
json.dumps(row.harvester, cls=JSONEncoder),
row.harvester.host,
row.record_id,
row.synonym,
......@@ -97,7 +98,7 @@
row.year])
pass
cfg_logsStore = json.dumps(cfg)
cfg_logsStore = json.dumps(cfg, cls=JSONEncoder)
#
# Write the Title on the HTML page
......
......@@ -22,6 +22,7 @@
#--------------------------------------------------------------------------
import json
from datetime import datetime
from plugin_dbui import JSONEncoder
#
# create the URL to compare id and ids
......@@ -82,7 +83,7 @@
cfg['data'].append(record)
pass
cfg_statStore = json.dumps(cfg)
cfg_statStore = json.dumps(cfg, cls=JSONEncoder)
#.........................................................................
#
......@@ -113,7 +114,7 @@
pass
pass
cfg_logsStore = json.dumps(cfg)
cfg_logsStore = json.dumps(cfg, cls=JSONEncoder)
#.........................................................................
#
......@@ -140,7 +141,7 @@
pass
pass
publications_fields = json.dumps(items)
publications_fields = json.dumps(items, cls=JSONEncoder)
#.........................................................................
#
......
......@@ -13,6 +13,7 @@
#
#--------------------------------------------------------------------------
import json
from plugin_dbui import JSONEncoder
#
# configure the Ext.data.Array
......@@ -25,7 +26,7 @@
cfg['data'] = data
cfg_store = json.dumps(cfg)
cfg_store = json.dumps(cfg, cls=JSONEncoder)
#
# unique identifier for the DIV block associated to a grid
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment