Commit 12e8cbb6 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Merge branch '93-fix-bugs' into 'master'

Resolve "fix bugs"

Closes #93

See merge request !95
parents 3b693acb cbd344db
--------------------------------- CHANGELOG ---------------------------------- --------------------------------- CHANGELOG ----------------------------------
HEAD HEAD
- Require plugin_dbui 0.9.9.0 or higher.
- More strict rule to select affiliation.
- Add a Go button in filter associated to grid.
- Restore the user role.
- Unlock authors_roles
0.9.7.0 (Oct 2017) 0.9.7.0 (Oct 2017)
- Require plugin_dbui 0.9.8.3 or higher. - Require plugin_dbui 0.9.8.3 or higher.
- Increase the length of the field harvesters.collections to 1024 - Increase the length of the field harvesters.collections to 1024
instead of 255. instead of 255.
- Change the rule for the field harvesters.collections. It now contains - Change the rule for the field harvesters.collections. It now contains
the definiton for a single collection (it was possible to define several the definiton for a single collection (it was possible to define several
collection separated by a comma but this confict with author encoding). collection separated by a comma but this confict with author encoding).
- Fix several bugs in the documentation and in the wizard harvesters. - Fix several bugs in the documentation and in the wizard harvesters.
......
...@@ -65,7 +65,7 @@ def index(): ...@@ -65,7 +65,7 @@ def index():
li = [el for el in section.orderby] li = [el for el in section.orderby]
field = db.publications[section.sort_field] field = db.publications[section.sort_field]
if section.direction == "DESC": if section.direction == "DESC":
field = ~field field = ~field
li.append(field) li.append(field)
......
...@@ -573,7 +573,7 @@ ...@@ -573,7 +573,7 @@
'Rejected': 'Rejeté', 'Rejected': 'Rejeté',
"Rejeté la chaine XML n'est pas correcte": "Rejeté la chaine XML n'est pas correcte", "Rejeté la chaine XML n'est pas correcte": "Rejeté la chaine XML n'est pas correcte",
'relation harvesters / categories': 'relation moissoneurs / catégories', 'relation harvesters / categories': 'relation moissoneurs / catégories',
'Relation team / projects': 'Relation équipe / projets', 'relation team / projects': 'relation équipe / projets',
'relation user / groups': 'relation utilisateur / groupes', 'relation user / groups': 'relation utilisateur / groupes',
'Removing affiliation failed. Rules might be missing for the given string. Contact the author.': 'Removing affiliation failed. Rules might be missing for the given string. Contact the author.', 'Removing affiliation failed. Rules might be missing for the given string. Contact the author.': 'Removing affiliation failed. Rules might be missing for the given string. Contact the author.',
'Render': 'Moteur de rendu', 'Render': 'Moteur de rendu',
......
...@@ -110,23 +110,28 @@ class CheckAndFix(object): ...@@ -110,23 +110,28 @@ class CheckAndFix(object):
app = current.app app = current.app
reg_institute = app.reg_institute reg_institute = app.reg_institute
# regular expression for the affiliation is not defined # regular expression for the affiliation keys
# build it using the affiliation keys. # protect special character
# add start and end of string for an exact match
if not reg_institute: if not reg_institute:
iterselect = db(db.affiliation_keys.id > 0).iterselect() lst = []
reg_institute = \ for row in db(db.affiliation_keys.id > 0).iterselect():
u"|".join(imap( val = row.key_u
lambda row: u"%(key_u)s%(key_v)s" % row, iterselect))
# protect special character val = (val
reg_institute = (reg_institute .replace("(", "\(")
.replace("(", "\\(") .replace(")", "\)")
.replace(")", "\\)") .replace("&", "\&")
.replace("&", "\\&") .replace("$", "\$")
.replace("$", "\\$") .replace("+", "\+")
.replace("+", "\\+") .replace("?", "\?"))
.replace("?", "\\?"))
val = r"(^|\|){}($|\|)" .format(val)
lst.append(val)
reg_institute = r"|".join(lst)
return reg_institute return reg_institute
......
...@@ -312,21 +312,21 @@ class RecordPubli(Record): ...@@ -312,21 +312,21 @@ class RecordPubli(Record):
Args: Args:
pattern (unicode): pattern (unicode):
regular expression defining the affiliation keys. regular expression defining the affiliation keys.
It should not contains groups. It has to be build for an exact match namely containing
start and end of string. This is reuqired to separate
`Ecole Plolytechnique` from `Ecole Polytechnique, Lausanne`.
Returns: Returns:
unicode: unicode:
- the affiliation - the affiliation or the first one when several are found.
- empty string when nothing is found. - empty string when nothing is found.
""" """
# modify the pattern to capture group df = self[u"700"]
pattern = "(%s)" % pattern query = df.u.str.contains(pattern)
data = (df[query].u.unique())
data = (self[u"700"].u.str.extract(pattern, expand=False)
.dropna())
return (data.iloc[0] if len(data) > 0 else u"") return (data[0] if len(data) > 0 else u"")
def find_authors(self, pattern, sep=u", ", sort=False): def find_authors(self, pattern, sep=u", ", sort=False):
"""Find authors containing the regular expression *pattern*. """Find authors containing the regular expression *pattern*.
...@@ -385,7 +385,6 @@ class RecordPubli(Record): ...@@ -385,7 +385,6 @@ class RecordPubli(Record):
""" """
df = self[u"700"] df = self[u"700"]
query = df.u.str.contains(pattern) query = df.u.str.contains(pattern)
if sort: if sort:
......
...@@ -73,7 +73,7 @@ class CoreUI(object): ...@@ -73,7 +73,7 @@ class CoreUI(object):
# #
# Grid # Grid
# #
mdf = GridModifier("authors_role") mdf = GridModifier("authors_roles")
mdf.configure_column("role", width=75) mdf.configure_column("role", width=75)
# .................................................................... # ....................................................................
......
...@@ -225,9 +225,9 @@ class ViewportUi(object): ...@@ -225,9 +225,9 @@ class ViewportUi(object):
node.add_children(leaves, func=to_grid) node.add_children(leaves, func=to_grid)
node.add_child( add_child = node.add_child
T("Relation team / projects"), add_child(T("relation team / projects"), to_grid("organisation"))
to_grid("organisation")) add_child(T("authors_roles"), to_grid("authors_roles"))
return node return node
......
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