Skip to content

Commit

Permalink
Don't break if translation can't be parsed
Browse files Browse the repository at this point in the history
If the .linfo file can't be parsed, use the untranslated name/summary,
but don't  break activity load.
  • Loading branch information
godiard authored and tchx84 committed Nov 25, 2014
1 parent 712682a commit f0927c3
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/sugar3/bundle/activitybundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,19 +229,22 @@ def _get_linfo_file(self):

def _parse_linfo(self, linfo_file):
cp = ConfigParser()
cp.readfp(linfo_file)
try:
cp.readfp(linfo_file)

section = 'Activity'
section = 'Activity'

if cp.has_option(section, 'name'):
self._name = cp.get(section, 'name')
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, '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(';')]
if cp.has_option(section, 'tags'):
tag_list = cp.get(section, 'tags').strip(';')
self._tags = [tag.strip() for tag in tag_list.split(';')]
except ConfigParser.ParsingError as e:
logging.exception('Exception reading linfo file: %s', e)

def get_locale_path(self):
"""Get the locale path inside the (installed) activity bundle."""
Expand Down

0 comments on commit f0927c3

Please sign in to comment.