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

Bug fixed in Automaton._is_record_in_db

Improve debugging message in Automaton class.
Add a protection against empty URL in Automaton._is_record_in_db 
parent 5453f846
......@@ -215,6 +215,10 @@ class Automaton(object):
raise ValueError
# protection empty url
if len(url) == 0:
return 0
# check the OAI
query = db.publications.origin.contains(url)
setrows = db(query)
......@@ -545,7 +549,10 @@ class Automaton(object):
print "\nprocessing record", rec_id
if is_record_in_db(title, host=host, rec_id=rec_id):
db_id = is_record_in_db(title, host=host, rec_id=rec_id)
if db_id:
if self.dbg:
print "record in db", rec_id, "->", db_id
xml = store.get_record(rec_id)
......@@ -588,6 +595,7 @@ class Automaton(object):
if self.dbg:
print "record decoded"
print record.title()
# reject the record using the secondary OAI
# require to cover the case:
......@@ -601,6 +609,10 @@ class Automaton(object):
tp = (record.secondary_oai_url(), record.primary_oai_url())
oai_url = "%s, %s" % tp
db.publications[rec_id] = dict(origin=oai_url)
if self.dbg:
print "record in db (secondary oai) ->", rec_id
# start the log for the record
......@@ -612,6 +624,8 @@ class Automaton(object):
# check that the record is well formed
# repair non-conformity as far as possible
if not check_record(record):
if self.dbg:
print "record rejected", logs[-1].txt
if self.dbg:
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