Skip to content
Snippets Groups Projects
Commit acda2fd5 authored by Henrik tom Wörden's avatar Henrik tom Wörden Committed by Florian Spreckelsen
Browse files

ENH: treat datamodel problems at more places

parent 65de5439
No related branches found
No related tags found
1 merge request!22Release 0.3
......@@ -193,12 +193,16 @@ class Crawler(object):
matches[idx].append(Cfood.__name__)
cfoods.append(Cfood(item))
logger.debug("{} matched\n{}.".format(
Cfood.__name__,
item))
Cfood.__name__,
item))
except DataInconsistencyError as e:
logger.debug(traceback.format_exc())
logger.debug(e)
except Exception as e:
try:
DataModelProblems.evaluate_exception(e)
except BaseException:
pass
logger.debug("Failed during execution of {}!".format(
Cfood.__name__))
logger.debug(traceback.format_exc())
......@@ -215,16 +219,18 @@ class Crawler(object):
for cfood in cfoods:
cfood.collect_information()
logger.debug(separated("Trying to attach further items to created CFoods"))
logger.debug(
separated("Trying to attach further items to created CFoods"))
for cfood in cfoods:
logger.debug("Matching against {}...".format(cfood.__class__.__name__))
logger.debug("Matching against {}...".format(
cfood.__class__.__name__))
for idx, item in self.iteritems():
if cfood.looking_for(item):
logger.debug("{} matched\n{}.".format(
cfood.__class__.__name__,
item))
cfood.__class__.__name__,
item))
cfood.attach(item)
matches[idx].append(cfood.__class__.__name__)
......@@ -245,7 +251,7 @@ class Crawler(object):
msg = ("Attention: More than one matching cfood!\n"
+ "Tried to match {}\n".format(item)
+ "\tRecordTypes:\t" + ", ".join(
matches[idx])+"\n")
matches[idx])+"\n")
logger.debug(msg, extra={"identifier": str(item),
'category': "matches"})
......@@ -284,6 +290,10 @@ class Crawler(object):
logger.debug(traceback.format_exc())
logger.debug(e)
except Exception as e:
try:
DataModelProblems.evaluate_exception(e)
except BaseException:
pass
logger.info("Failed during execution of {}!".format(
cfood.__class__.__name__))
logger.debug(traceback.format_exc())
......@@ -301,7 +311,8 @@ class Crawler(object):
# only done in SSS mode
if "SHARED_DIR" in os.environ:
filename = self.save_form([el[3] for el in pending_changes], path)
filename = self.save_form([el[3]
for el in pending_changes], path)
self.send_mail([el[3] for el in pending_changes], filename)
for i, el in enumerate(pending_changes):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment