Skip to content

Commit

Permalink
Prevent a crash when updating pootle-terminology.po
Browse files Browse the repository at this point in the history
When the file does not exist on disk, accessing attributes on
self.file will fail. So check for that in advance. If this happens
on anything else than pootle-terminology.po, log a warning.

Fixes #3254
  • Loading branch information
jleclanche committed Sep 8, 2014
1 parent 49072f5 commit 0f56c9b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pootle/apps/pootle_store/models.py
Expand Up @@ -1597,6 +1597,13 @@ def update(self, update_structure=False, update_translation=False,
self.parse(store=store)
return

if not self.file:
# This will always happen for pootle-terminology.po, don't warn
if not self.pootle_path.endswith("pootle-terminology.po"):
logging.warning(u"Attempted to update a non-existing file",
self.pootle_path)
return

if only_newer:
disk_mtime = datetime.datetime \
.fromtimestamp(self.file.getpomtime()[0])
Expand Down

0 comments on commit 0f56c9b

Please sign in to comment.