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

Activate lazy translation.

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