Commit 7e4b1bc9 authored by legac's avatar legac
Browse files

Review the harvester logic and the error detection. An harvester can be

associated to a team, a project or both. Polish the interface to extract
authors list from a string.
parent f0854d97
......@@ -9,8 +9,13 @@ from harvest_tools import (Articles,
Proceedings,
Reports,
Talks,
ToolException,
Thesis)
def index():
return T('Select an "harvester" !!!')
def articles():
"""Scan the cds/invenio stores to find articles published during year range
and for a given team. Insert them in the database if they don't exist.
......@@ -24,7 +29,10 @@ def articles():
try:
tool = Articles(debug=False)
tool.process(db)
except ToolException, e:
return T(str(e))
except BaseException, e:
msg = '<br><br><hr/>'
msg += CODE(traceback.format_exc()).xml()
......@@ -50,6 +58,9 @@ def notes():
tool = Notes(debug=False)
tool.process(db)
except ToolException, e:
return T(str(e))
except BaseException, e:
msg = '<br><br><hr/>'
msg += CODE(traceback.format_exc()).xml()
......@@ -75,6 +86,9 @@ def preprints():
tool = Preprints(debug=False)
tool.process(db)
except ToolException, e:
return T(str(e))
except BaseException, e:
msg = '<br><br><hr/>'
msg += CODE(traceback.format_exc()).xml()
......@@ -100,6 +114,9 @@ def proceedings():
tool = Proceedings(debug=False)
tool.process(db)
except ToolException, e:
return T(str(e))
except BaseException, e:
msg = '<br><br><hr/>'
msg += CODE(traceback.format_exc()).xml()
......@@ -125,6 +142,9 @@ def reports():
tool = Reports(debug=False)
tool.process(db)
except ToolException, e:
return T(str(e))
except BaseException, e:
msg = '<br><br><hr/>'
msg += CODE(traceback.format_exc()).xml()
......@@ -149,6 +169,9 @@ def talks():
tool = Talks(debug=False)
tool.process(db)
except ToolException, e:
return T(str(e))
except BaseException, e:
msg = '<br><br><hr/>'
msg += CODE(traceback.format_exc()).xml()
......@@ -174,6 +197,9 @@ def theses():
tool = Thesis(debug=False)
tool.process(db)
except ToolException, e:
return T(str(e))
except BaseException, e:
msg = '<br><br><hr/>'
msg += CODE(traceback.format_exc()).xml()
......
......@@ -4,15 +4,21 @@
import plugin_dbui
import re
def extract_authors():
"""Controller to extract a list of authors in a string containing
author name and their affiliation. It also extract authors for a
given affiliation.
"""
vars = request.vars
# decode selector parameters
for key in vars:
t = plugin_dbui.decode_field(key)
if 'institute' in t:
institute = vars[key]
if 'affiliation' in t:
affiliation = vars[key]
elif 'authors' in t:
authors = vars[key]
......@@ -34,11 +40,7 @@ def extract_authors():
all_authors.append(author)
if el.group(2) == institute:
if el.group(2) == affiliation:
cppm_authors.append(author)
# rep = '<br>ALL AUTHORS<br><br>'
# rep += ', '.join(all_authors)
# rep += '<br><br>CPPM AUTHORS<br><br>'
# rep += ', '.join(cppm_authors)
return dict(all=', '.join(all_authors), cppm=', '.join(cppm_authors))
\ No newline at end of file
doc/database.png

120 KB | W: | H:

doc/database.png

174 KB | W: | H:

doc/database.png
doc/database.png
doc/database.png
doc/database.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -22,4 +22,4 @@
<type label="Upload" length="0" sql="upload" quote="'"/>
<type label="Password" length="0" sql="password" quote="'"/>
</group>
</datatypes><table x="70" y="142" name="publishers"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="publisher" null="0" autoincrement="0"><datatype>string</datatype></row><row name="abbreviation" null="0" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="234" y="64" name="publications"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="title" null="0" autoincrement="0"><datatype>text</datatype></row><row name="first_author" null="0" autoincrement="0"><datatype>string</datatype></row><row name="authors" null="0" autoincrement="0"><datatype>text</datatype></row><row name="id_collaborations" null="1" autoincrement="0"><datatype>integer</datatype><relation table="collaborations" row="id" /></row><row name="id_publishers" null="1" autoincrement="0"><datatype>integer</datatype><relation table="publishers" row="id" /></row><row name="year" null="0" autoincrement="0"><datatype>integer</datatype></row><row name="volume" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="pages" null="1" autoincrement="0"><datatype>string</datatype></row><row name="submitted" null="1" autoincrement="0"><datatype>string</datatype></row><row name="preprint" null="1" autoincrement="0"><datatype>string</datatype></row><row name="publication_url" null="1" autoincrement="0"><datatype>string</datatype></row><row name="conference_title" null="1" autoincrement="0"><datatype>string</datatype></row><row name="conference_url" null="1" autoincrement="0"><datatype>string</datatype></row><row name="conference_dates" null="1" autoincrement="0"><datatype>string</datatype></row><row name="conference_town" null="1" autoincrement="0"><datatype>string</datatype></row><row name="id_countries" null="1" autoincrement="0"><datatype>integer</datatype><relation table="countries" row="id" /></row><row name="conference_speaker" null="1" autoincrement="0"><datatype>string</datatype></row><row name="report_numbers" null="1" autoincrement="0"><datatype>string</datatype></row><row name="id_reports" null="0" autoincrement="0"><datatype>integer</datatype><relation table="reports" row="id" /></row><row name="book_isbn" null="0" autoincrement="0"><datatype>string</datatype></row><row name="book_issn" null="0" autoincrement="0"><datatype>string</datatype></row><row name="book_chapters" null="0" autoincrement="0"><datatype>string</datatype></row><row name="authors_cppm" null="0" autoincrement="0"><datatype>text</datatype></row><row name="id_authors_roles" null="0" autoincrement="0"><datatype>integer</datatype><relation table="authors_roles" row="id" /></row><row name="id_teams" null="1" autoincrement="0"><datatype>integer</datatype><relation table="teams" row="id" /></row><row name="id_projects" null="1" autoincrement="0"><datatype>integer</datatype><relation table="projects" row="id" /></row><row name="id_categories" null="1" autoincrement="0"><datatype>integer</datatype><relation table="categories" row="id" /></row><row name="id_status" null="0" autoincrement="0"><datatype>integer</datatype><relation table="status" row="id" /></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="77" y="350" name="countries"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="country" null="0" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="433" y="282" name="teams"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="team" null="0" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="432" y="373" name="projects"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="project" null="0" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="434" y="628" name="categories"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="code" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="0" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="418" y="158" name="collaborations"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="collaboration" null="0" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="90" y="452" name="reports"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="type" null="0" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="434" y="493" name="status"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="code" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="0" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="647" y="66" name="diplomas"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="title" null="0" autoincrement="0"><datatype>text</datatype></row><row name="author" null="0" autoincrement="0"><datatype>string</datatype></row><row name="universities" null="0" autoincrement="0"><datatype>string</datatype></row><row name="directors" null="0" autoincrement="0"><datatype>string</datatype></row><row name="defense" null="0" autoincrement="0"><datatype>string</datatype></row><row name="id_levels" null="0" autoincrement="0"><datatype>integer</datatype><relation table="levels" row="id" /></row><row name="url" null="0" autoincrement="0"><datatype>string</datatype></row><row name="id_teams" null="0" autoincrement="0"><datatype>integer</datatype><relation table="teams" row="id" /></row><row name="id_projects" null="0" autoincrement="0"><datatype>integer</datatype><relation table="projects" row="id" /></row><row name="id_status" null="0" autoincrement="0"><datatype>integer</datatype><relation table="status" row="id" /></row><row name="year" null="0" autoincrement="0"><datatype>integer</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="795" y="247" name="levels"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="level" null="0" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="614" y="460" name="harvesters"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="id_teams" null="0" autoincrement="0"><datatype>integer</datatype><relation table="teams" row="id" /></row><row name="controller" null="0" autoincrement="0"><datatype>string</datatype></row><row name="host" null="0" autoincrement="0"><datatype>string</datatype></row><row name="collections" null="0" autoincrement="0"><datatype>string</datatype></row><row name="ratio" null="0" autoincrement="0"><datatype>double</datatype></row><row name="id_categories" null="0" autoincrement="0"><datatype>integer</datatype><relation table="categories" row="id" /></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="45" y="589" name="authors_roles"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="role" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="787" y="346" name="cppm_authors"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="year" null="0" autoincrement="0"><datatype>integer</datatype></row><row name="id_teams" null="0" autoincrement="0"><datatype>integer</datatype><relation table="teams" row="id" /></row><row name="id_projects" null="0" autoincrement="0"><datatype>integer</datatype><relation table="projects" row="id" /></row><row name="names" null="0" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table></sql>
\ No newline at end of file
</datatypes><table x="70" y="142" name="publishers"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="publisher" null="0" autoincrement="0"><datatype>string</datatype></row><row name="abbreviation" null="0" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="234" y="64" name="publications"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="title" null="0" autoincrement="0"><datatype>text</datatype></row><row name="first_author" null="0" autoincrement="0"><datatype>string</datatype></row><row name="authors" null="0" autoincrement="0"><datatype>text</datatype></row><row name="id_collaborations" null="1" autoincrement="0"><datatype>integer</datatype><relation table="collaborations" row="id" /></row><row name="id_publishers" null="1" autoincrement="0"><datatype>integer</datatype><relation table="publishers" row="id" /></row><row name="year" null="0" autoincrement="0"><datatype>integer</datatype></row><row name="volume" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="pages" null="1" autoincrement="0"><datatype>string</datatype></row><row name="submitted" null="1" autoincrement="0"><datatype>string</datatype></row><row name="preprint" null="1" autoincrement="0"><datatype>string</datatype></row><row name="publication_url" null="1" autoincrement="0"><datatype>string</datatype></row><row name="conference_title" null="1" autoincrement="0"><datatype>string</datatype></row><row name="conference_url" null="1" autoincrement="0"><datatype>string</datatype></row><row name="conference_dates" null="1" autoincrement="0"><datatype>string</datatype></row><row name="conference_town" null="1" autoincrement="0"><datatype>string</datatype></row><row name="id_countries" null="1" autoincrement="0"><datatype>integer</datatype><relation table="countries" row="id" /></row><row name="conference_speaker" null="1" autoincrement="0"><datatype>string</datatype></row><row name="report_numbers" null="1" autoincrement="0"><datatype>string</datatype></row><row name="id_reports" null="0" autoincrement="0"><datatype>integer</datatype><relation table="reports" row="id" /></row><row name="book_isbn" null="0" autoincrement="0"><datatype>string</datatype></row><row name="book_issn" null="0" autoincrement="0"><datatype>string</datatype></row><row name="book_chapters" null="0" autoincrement="0"><datatype>string</datatype></row><row name="authors_cppm" null="0" autoincrement="0"><datatype>text</datatype></row><row name="id_authors_roles" null="0" autoincrement="0"><datatype>integer</datatype><relation table="authors_roles" row="id" /></row><row name="id_teams" null="1" autoincrement="0"><datatype>integer</datatype><relation table="teams" row="id" /></row><row name="id_projects" null="1" autoincrement="0"><datatype>integer</datatype><relation table="projects" row="id" /></row><row name="id_categories" null="1" autoincrement="0"><datatype>integer</datatype><relation table="categories" row="id" /></row><row name="id_status" null="0" autoincrement="0"><datatype>integer</datatype><relation table="status" row="id" /></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="77" y="350" name="countries"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="country" null="0" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="433" y="282" name="teams"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="team" null="0" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="432" y="373" name="projects"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="project" null="0" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="434" y="628" name="categories"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="code" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="0" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="418" y="158" name="collaborations"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="collaboration" null="0" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="90" y="452" name="reports"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="type" null="0" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="434" y="493" name="status"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="code" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="0" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="647" y="66" name="diplomas"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="title" null="0" autoincrement="0"><datatype>text</datatype></row><row name="author" null="0" autoincrement="0"><datatype>string</datatype></row><row name="universities" null="0" autoincrement="0"><datatype>string</datatype></row><row name="directors" null="0" autoincrement="0"><datatype>string</datatype></row><row name="defense" null="0" autoincrement="0"><datatype>string</datatype></row><row name="id_levels" null="0" autoincrement="0"><datatype>integer</datatype><relation table="levels" row="id" /></row><row name="url" null="0" autoincrement="0"><datatype>string</datatype></row><row name="id_teams" null="0" autoincrement="0"><datatype>integer</datatype><relation table="teams" row="id" /></row><row name="id_projects" null="0" autoincrement="0"><datatype>integer</datatype><relation table="projects" row="id" /></row><row name="id_status" null="0" autoincrement="0"><datatype>integer</datatype><relation table="status" row="id" /></row><row name="year" null="0" autoincrement="0"><datatype>integer</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="795" y="247" name="levels"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="level" null="0" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="641" y="482" name="harvesters"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="id_teams" null="0" autoincrement="0"><datatype>integer</datatype><relation table="teams" row="id" /></row><row name="id_projects" null="0" autoincrement="0"><datatype>integer</datatype><relation table="projects" row="id" /></row><row name="controller" null="0" autoincrement="0"><datatype>string</datatype></row><row name="host" null="0" autoincrement="0"><datatype>string</datatype></row><row name="collections" null="0" autoincrement="0"><datatype>string</datatype></row><row name="ratio" null="0" autoincrement="0"><datatype>double</datatype></row><row name="id_categories" null="0" autoincrement="0"><datatype>integer</datatype><relation table="categories" row="id" /></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="45" y="589" name="authors_roles"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="role" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="787" y="346" name="cppm_authors"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="year" null="0" autoincrement="0"><datatype>integer</datatype></row><row name="id_teams" null="0" autoincrement="0"><datatype>integer</datatype><relation table="teams" row="id" /></row><row name="id_projects" null="0" autoincrement="0"><datatype>integer</datatype><relation table="projects" row="id" /></row><row name="names" null="0" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table></sql>
\ No newline at end of file
......@@ -11,6 +11,7 @@
'ASCL': 'ASCL',
'Abbreviation': 'Abréviation',
'Address of the invenio store where the search is performed.': 'Addresse du site invenio où les recherches sont effectuées.',
'Affiliation': 'Affiliation',
'Are you sure you want to delete this object?': 'Voulez-vous vraiment détruire cet object ?',
'Articles': 'Articles',
'Author': 'Auteur',
......@@ -63,6 +64,8 @@
'Group %(group_id)s created': 'Group %(group_id)s created',
'Group ID': 'Group ID',
'Group uniquely assigned to user %(id)s': 'Group uniquely assigned to user %(id)s',
'Harvest': 'Moissonner',
'Harvester parameters not defined in the database.': 'Harvester parameters not defined in the database.',
'Host': 'Host',
'ISBN': 'ISBN',
'ISSN': 'ISSN',
......@@ -134,7 +137,11 @@
'Rows in table': 'Rows in table',
'Rôle': 'Rôle',
'Save profile': 'Save profile',
'Select': 'Selectionner',
'Select': 'Sélectionner',
'Select a "category" !!!': 'Sélectionner une "catégorie" !!!',
'Select a "project" !!!': 'Sélectionner un "projet" !!!',
'Select a "team" !!!': 'Sélectionner une "équipe" !!!',
'Select an "harvester" !!!': 'Sélectionner un "moissonneur" !!!',
'Service': 'Service',
'Speaker': 'Orateur',
'Status': 'Status',
......
......@@ -132,6 +132,7 @@ T("Parameter for fuzzy string search.")
db.define_table("harvesters",
Field("id_teams", db.teams, default=undef_id, label='Team'),
Field("id_projects", db.projects, default=undef_id, label='Project'),
Field("controller", "string", notnull=True, comment=tp_controller),
Field("host", "string", notnull=True, default='cdsweb.cern.ch', comment=tp_host),
Field("collections", "string", comment=tp_collections),
......@@ -145,6 +146,9 @@ IS_IN_SET(['articles', 'proceedings', 'reports', 'talks'])
db.harvesters.id_categories.requires = \
IS_IN_DB(db, 'categories.id', 'categories.code')
db.harvesters.id_projects.requires = \
IS_IN_DB(db, 'projects.id', 'projects.project')
db.harvesters.id_teams.requires = \
IS_IN_DB(db, 'teams.id', 'teams.team')
......
......@@ -111,24 +111,28 @@ if db(db.cppm_authors.id).count() == 0:
if db(db.harvesters.id).count() == 0:
db.harvesters.insert(id=1,
id_teams=2,
id_projects=undef_id,
controller='articles',
collections='LHCb Papers, LHCb Detector Performance Papers',
id_categories=2)
db.harvesters.insert(id=2,
id_teams=2,
id_projects=undef_id,
controller='notes',
collections='LHCb Public Notes, LHCb Conference Contributions',
id_categories=14)
db.harvesters.insert(id=3,
id_teams=2,
id_projects=undef_id,
controller='preprints',
collections='LHCb Papers, LHCb Detector Performance Papers',
id_categories=15)
db.harvesters.insert(id=4,
id_teams=2,
id_projects=undef_id,
controller='proceedings',
collections='LHCb Conference Proceedings',
id_categories=7,
......@@ -136,12 +140,14 @@ if db(db.harvesters.id).count() == 0:
db.harvesters.insert(id=5,
id_teams=2,
id_projects=undef_id,
controller='reports',
collections='LHCb Reports',
id_categories=14)
db.harvesters.insert(id=6,
id_teams=2,
id_projects=undef_id,
controller='talks',
collections='LHCb Talks',
id_categories=9,
......@@ -149,6 +155,7 @@ if db(db.harvesters.id).count() == 0:
db.harvesters.insert(id=7,
id_teams=2,
id_projects=undef_id,
controller='theses',
collections='LHCb Theses',
id_categories=1)
......
......@@ -17,12 +17,12 @@ virtdb = DAL(None)
tp_authors = \
T("String containing the author names with their institutes number.")
tp_institute = \
tp_affiliation = \
T("Institute number associated to CPPM authors")
virtdb.define_table('authors_selector',
Field('authors', 'text', comment=tp_authors, requires=IS_LENGTH(65535)),
Field('institute', 'integer', comment=tp_institute))
Field('affiliation', 'integer', comment=tp_affiliation))
#
# harvester selector
......@@ -31,7 +31,8 @@ virtdb.define_table('harvester_selector',
Field('year_start', 'integer', default=year),
Field('year_end', 'integer'),
Field('id_teams', db.teams, label='Team'),
Field('controller', 'string', label='Process'))
Field('id_projects', db.projects, label='Project'),
Field('controller', 'string', label='Harvest'))
virtdb.harvester_selector.controller.requires = IS_IN_SET(['articles',
'notes',
......@@ -41,6 +42,10 @@ virtdb.harvester_selector.controller.requires = IS_IN_SET(['articles',
'talks',
'theses'])
virtdb.harvester_selector.id_projects.requires = IS_IN_DB(db,
'projects.id',
'projects.project')
virtdb.harvester_selector.id_teams.requires = IS_IN_DB(db,
'teams.id',
'teams.team')
......@@ -58,8 +63,8 @@ virtdb.define_table('list_selector',
Field('format', 'string', default='html'))
virtdb.list_selector.id_projects.requires = IS_IN_DB(db,
'projects.id',
'projects.project')
'projects.id',
'projects.project')
virtdb.list_selector.id_teams.requires = IS_IN_DB(db,
'teams.id',
......@@ -77,6 +82,7 @@ tp_xml = T('The XML string describing the MARC12 record. '
virtdb.define_table('marc12_selector',
Field('id_teams', db.teams, label='Team'),
Field('id_projects', db.projects, label='Project'),
Field('xml', 'text', comment=tp_xml, label='MARCXML'),
Field('controller', 'string', label='Process as'),
Field('id_categories', db.categories, label='Category'))
......@@ -94,6 +100,10 @@ virtdb.marc12_selector.controller.requires = IS_IN_SET(['articles',
'talks',
'theses'])
virtdb.marc12_selector.id_projects.requires = IS_IN_DB(db,
'projects.id',
'projects.project')
virtdb.marc12_selector.id_teams.requires = IS_IN_DB(db,
'teams.id',
'teams.team')
......
......@@ -18,10 +18,12 @@ from gluon import current
from gluon.storage import Storage
# error messages
MSG_NO_CAT = 'Select a "category" !!!'
MSG_NO_CONF = 'Missing record for conference key %s'
MSG_NO_HARVESTER = 'Harvester parameters not defined in the database.'
MSG_NO_LINK = 'Record not link to a conference'
MSG_NO_TEAM = 'Team not defined in the database.'
MSG_NO_PROJECT = 'Select a "project" !!!'
MSG_NO_TEAM = 'Select a "team" !!!'
# regular expression to find CPPM in institute list
REG_CPPM = 'CPPM|[Mm]arseille'
......@@ -259,6 +261,7 @@ class PublicationsTool(object):
self.ninsert = 0
self.ratio = None
self.re_year = ''
self.id_project = None
self.id_team = None
self.xml = None
self.y1 = None
......@@ -287,14 +290,23 @@ class PublicationsTool(object):
self.y2 = vars[key]
elif 'id_categories' in t:
self.id_category = vars[key]
elif 'id_projects' in t:
self.id_project = vars[key]
elif 'id_teams' in t:
self.id_team = vars[key]
elif 'xml' in t:
self.xml = vars[key]
# protection team, project and/or category have to be defined
if not self.id_project:
raise ToolException(MSG_NO_PROJECT)
if not self.id_team:
raise ToolException(MSG_NO_TEAM)
if self.xml and not self.id_category:
raise ToolException(MSG_NO_CAT)
# the source is an XML string
# no need to define a year range
if self.xml:
......@@ -319,8 +331,9 @@ class PublicationsTool(object):
"""
# harvester parameters
# it is defined by the name of the controller and the team
# an harvester is associated to a team, a project and a controller
id = get_id(db, 'harvesters', controller=current.request.function,
id_projects=self.id_project,
id_teams=self.id_team)
if not id:
......
......@@ -2,10 +2,13 @@
HEAD
- Review the logic of the harvester. An XML record can be enter without
the configuration of an harvester. A team is enough.
- Review the logic of the harvester and the error messaging.
Harvester can be parameterized for a team, a project or both.
- Review the interface to enter an MARC XML record. It can be associated
for a team a project or both. It does not required the parameterization
of an harvester.
- Add an helper tools to extract the list of authors from a string containing
author names and affiliation.
author names and their affiliation.
- Increase the number of character allowed for the authors field.
0.3.2 (July 2012)
......
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