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
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
limbra
limbra
Commits
f141ac1a
Commit
f141ac1a
authored
Nov 07, 2019
by
LE GAC Renaud
Browse files
Update to remove encode('utf-8') and decode('utf-8').
parent
1ea1f46f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
18 deletions
+15
-18
controllers/graphs.py
controllers/graphs.py
+3
-3
modules/graph_tools.py
modules/graph_tools.py
+8
-8
modules/harvest_tools/base.py
modules/harvest_tools/base.py
+1
-1
modules/invenio_tools/recordpubli.py
modules/invenio_tools/recordpubli.py
+1
-4
modules/model_core.py
modules/model_core.py
+2
-2
No files found.
controllers/graphs.py
View file @
f141ac1a
...
...
@@ -53,8 +53,8 @@ def dashboard():
selector
.
Graph_selectorYear_start
=
min_year
selector
.
Graph_selectorYear_end
=
max_year
title
=
(
T
(
FROM_TO
)
%
(
min_year
,
max_year
)
).
decode
(
"utf-8"
)
ylabel
=
T
(
LABELY_YEAR
)
.
decode
(
"utf-8"
)
title
=
T
(
FROM_TO
)
%
(
min_year
,
max_year
)
ylabel
=
T
(
LABELY_YEAR
)
linechart
(
db
,
selector
,
...
...
@@ -70,7 +70,7 @@ def dashboard():
selector
.
Graph_selectorYear_start
=
year
selector
.
Graph_selectorYear_end
=
""
title
=
(
T
(
"In %s"
)
%
year
).
decode
(
"utf-8"
)
title
=
T
(
"In %s"
)
%
year
linechart
(
db
,
selector
,
target
=
ax2
,
title
=
title
)
# delegate the rendering to the view
...
...
modules/graph_tools.py
View file @
f141ac1a
...
...
@@ -132,10 +132,10 @@ def emptychart(db, selector, target=None):
ax
.
tick_params
(
which
=
"minor"
,
length
=
4
)
# x and y labels
xlabel
=
T
(
DATE_SUB
)
.
decode
(
"utf-8"
)
xlabel
=
T
(
DATE_SUB
)
ax
.
set_xlabel
(
xlabel
,
x
=
1
,
horizontalalignment
=
"right"
)
ylabel
=
T
(
LABELY
)
.
decode
(
"utf-8"
)
ylabel
=
T
(
LABELY
)
ax
.
set_ylabel
(
ylabel
,
y
=
1
,
horizontalalignment
=
"right"
)
# main title of the graph
...
...
@@ -256,7 +256,7 @@ def linechart(db, selector, target=None, title=None, xlabel=None, ylabel=None):
# x label
if
xlabel
is
None
:
xlabel
=
T
(
DATE_PUB
if
is_publish_year
else
DATE_SUB
)
.
decode
(
"utf-8"
)
xlabel
=
T
(
DATE_PUB
if
is_publish_year
else
DATE_SUB
)
ax
.
set_xlabel
(
xlabel
,
x
=
1
,
horizontalalignment
=
"right"
)
...
...
@@ -273,7 +273,7 @@ def linechart(db, selector, target=None, title=None, xlabel=None, ylabel=None):
else
:
ylabel
=
LABELY_YEAR
ylabel
=
T
(
ylabel
)
.
decode
(
"utf-8"
)
ylabel
=
T
(
ylabel
)
ax
.
set_ylabel
(
ylabel
,
y
=
1
,
horizontalalignment
=
"right"
)
# main title of the graph
...
...
@@ -440,7 +440,7 @@ def set_title(ax, db, selector):
period
=
year_start
title
=
"%s %s"
%
(
title
,
period
)
ax
.
set_title
(
title
.
decode
(
"utf-8"
)
)
ax
.
set_title
(
title
)
def
stackchart
(
db
,
selector
,
target
=
None
):
...
...
@@ -538,7 +538,7 @@ def stackchart(db, selector, target=None):
ax
.
tick_params
(
which
=
"minor"
,
length
=
4
)
# x and y labels
xlabel
=
T
(
DATE_PUB
if
is_publish_year
else
DATE_SUB
)
.
decode
(
"utf-8"
)
xlabel
=
T
(
DATE_PUB
if
is_publish_year
else
DATE_SUB
)
ax
.
set_xlabel
(
xlabel
,
x
=
1
,
horizontalalignment
=
"right"
)
# y label
...
...
@@ -553,14 +553,14 @@ def stackchart(db, selector, target=None):
else
:
ylabel
=
LABELY_YEAR
ylabel
=
T
(
ylabel
)
.
decode
(
"utf-8"
)
ylabel
=
T
(
ylabel
)
ax
.
set_ylabel
(
ylabel
,
y
=
1
,
horizontalalignment
=
"right"
)
# legend title is the name of the axis
axis
=
(
axis
if
axis
==
"categories"
else
graph
.
stack_granularity
)
legend
=
ax
.
get_legend
()
legend
.
set_title
(
T
(
axis
)
.
decode
(
"utf-8"
)
)
legend
.
set_title
(
T
(
axis
))
# main title of the graph
set_title
(
ax
,
db
,
selector
)
...
...
modules/harvest_tools/base.py
View file @
f141ac1a
...
...
@@ -126,7 +126,7 @@ def search_synonym(table, fieldname, value, create=False):
return
id_rec
# nothing found, have a look to the synonyms field
query
=
table
.
synonyms
.
contains
(
value
.
encode
(
'utf-8'
)
)
query
=
table
.
synonyms
.
contains
(
value
)
setrows
=
db
(
query
)
# no synonym found, create the entry
...
...
modules/invenio_tools/recordpubli.py
View file @
f141ac1a
...
...
@@ -396,10 +396,7 @@ class RecordPubli(Record):
.
sort_index
()
.
fmt_name
)
data
=
data
.
str
.
encode
(
"utf-8"
)
sep
=
sep
.
encode
(
"utf-8"
)
return
(
sep
.
join
(
data
)
if
len
(
data
)
>
0
else
""
).
decode
(
"utf-8"
)
return
(
sep
.
join
(
data
)
if
len
(
data
)
>
0
else
""
)
def
first_author
(
self
):
"""The name of the first author.
...
...
modules/model_core.py
View file @
f141ac1a
...
...
@@ -14,6 +14,7 @@ from gluon import current
from
gluon.validators
import
(
IS_EMPTY_OR
,
IS_IN_DB
,
IS_INT_IN_RANGE
,
IS_IN_SET
,
IS_LENGTH
,
IS_MATCH
,
IS_URL
)
...
...
@@ -22,7 +23,6 @@ from plugin_dbui import (CLEAN_COMMA,
CLEAN_SPACES
,
INHIBIT_DELETE_UNDEF
,
INHIBIT_UPDATE_UNDEF
,
IS_IN_USET
,
UNDEF
,
UNDEF_ID
)
...
...
@@ -132,7 +132,7 @@ class Core(object):
Core
.
_protect
(
table
)
cat_usual
=
sorted
([
T
(
el
)
for
el
in
CAT_USUAL
])
table
.
usual
.
requires
=
IS_IN_
U
SET
(
cat_usual
)
table
.
usual
.
requires
=
IS_IN_SET
(
cat_usual
)
table
.
code
.
filter_in
=
CLEAN_SPACES
table
.
usual
.
filter_in
=
CLEAN_SPACES
...
...
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