From aca045bde2cfd3d5d945919ec0dc895e7c865d4e Mon Sep 17 00:00:00 2001 From: James Cameron Date: Fri, 27 Dec 2019 14:15:39 +1100 Subject: [PATCH] Reduce width of exception handler for linfo file ParsingError is only expected during read. --- src/sugar3/bundle/activitybundle.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/sugar3/bundle/activitybundle.py b/src/sugar3/bundle/activitybundle.py index 2b5e2f44..ec1b47ca 100644 --- a/src/sugar3/bundle/activitybundle.py +++ b/src/sugar3/bundle/activitybundle.py @@ -252,20 +252,21 @@ class ActivityBundle(Bundle): cp = ConfigParser() try: cp.read_string(linfo_file.read().decode()) - - section = 'Activity' - - if cp.has_option(section, 'name'): - self._name = cp.get(section, 'name') - - if cp.has_option(section, 'summary'): - self._summary = cp.get(section, 'summary') - - if cp.has_option(section, 'tags'): - tag_list = cp.get(section, 'tags').strip(';') - self._tags = [tag.strip() for tag in tag_list.split(';')] except ParsingError as e: logging.exception('Exception reading linfo file: %s', e) + return + + section = 'Activity' + + if cp.has_option(section, 'name'): + self._name = cp.get(section, 'name') + + if cp.has_option(section, 'summary'): + self._summary = cp.get(section, 'summary') + + if cp.has_option(section, 'tags'): + tag_list = cp.get(section, 'tags').strip(';') + self._tags = [tag.strip() for tag in tag_list.split(';')] def get_locale_path(self): """Get the locale path inside the (installed) activity bundle."""