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

Improved algorithm to identfy thesis directors.

parent ff5706f7
......@@ -95,6 +95,7 @@ REG_SUBMITTED = re.compile("\d{4}-\d{2}")
REG_VOLUME = re.compile('[A-Z]+ *(\d.*)')
REG_YEAR = re.compile("(\d{4})")
THESIS_DIR = u"dir."
class ExceptionUTF8(Exception):
"""Exception in which unicode arguments are encoded as a string.
......@@ -1683,8 +1684,17 @@ class Record(dict):
"""
authors = []
if "700" in self:
authors = self._get("700", 'a', force_list=True)
# NOTE: the content of the 700 field depend on the record type.
# For thesis it also contains the name of the director
if "700" in self and isinstance(self["700"], dict):
if not ("e" in self["700"] and self["700"]["e"] == THESIS_DIR):
authors.append(self["700"]["a"])
elif "700" in self and isinstance(self["700"], list):
for di in self["700"]:
if "e" in di and di["e"] == THESIS_DIR:
continue
authors.append(di["a"])
return authors
......@@ -2320,11 +2330,17 @@ class Record(dict):
- Empty string when not defined.
"""
# NOTE director are store in the author list
# NOTE director are stored in the author field
# the first author is not a director !
li = []
for el in self._get("700", 'a', force_list=True):
li.append(self._format(el))
if "700" in self and isinstance(self["700"], dict):
if "e" in self["700"] and self["700"]["e"] == THESIS_DIR:
li.append(self["700"]["a"])
elif "700" in self and isinstance(self["700"], list):
for di in self["700"]:
if "e" in di and di["e"] == THESIS_DIR:
li.append(di["a"])
return ', '.join(li)
......
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