Commit e3092e54 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update CheckAndFix._get_reg_institute to simplify it using itertools.

parent 2d8850fc
......@@ -7,6 +7,7 @@ import regex
from base import search_synonym, ToolException
from exception import CheckException
from gluon import current
from invenio_tools import (DECODE_REF,
......@@ -17,7 +18,7 @@ from invenio_tools import (DECODE_REF,
from gluon import current
from itertools import imap
from plugin_dbui import CLEAN_SPACES, get_id
......@@ -111,15 +112,10 @@ class CheckAndFix(object):
# build it using the affiliation keys.
if not reg_institute:
reg_institute = None
for row in db( > 0).iterselect():
func = lambda row: u"^%(key_u)s%(key_v)s" % row
reg = "^%(key_u)s%(key_v)s" % row
if reg_institute is None:
reg_institute = reg
reg_institute = "%s|%s" % (reg_institute, reg)
iterselect = db( > 0).iterselect()
reg_institute = u"|".join(imap(func, iterselect))
return reg_institute
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