diff babel/messages/pofile.py @ 356:4cdca48fc832 trunk

Fixed #59 by falling back silently on invalid location comments.
author aronacher
date Tue, 17 Jun 2008 20:40:36 +0000
parents 2ee7dc04836c
children bc18179832b7
line wrap: on
line diff
--- a/babel/messages/pofile.py
+++ b/babel/messages/pofile.py
@@ -208,8 +208,13 @@
                 _add_message()
             if line[1:].startswith(':'):
                 for location in line[2:].lstrip().split():
-                    filename, lineno = location.split(':', 1)
-                    locations.append((filename, int(lineno)))
+                    pos = location.rfind(':')
+                    if pos >= 0:
+                        try:
+                            lineno = int(location[pos + 1:])
+                        except ValueError:
+                            continue
+                        locations.append((location[:pos], lineno))
             elif line[1:].startswith(','):
                 for flag in line[2:].lstrip().split(','):
                     flags.append(flag.strip())
Copyright (C) 2012-2017 Edgewall Software