diff babel/messages/pofile.py @ 369:c2ae38340540 stable-0.9.x

Ported [388:405/trunk] to 0.9.x branch.
author cmlenz
date Fri, 27 Jun 2008 15:22:12 +0000
parents 3d67cf6d8022
children 1c0915da48c6
line wrap: on
line diff
--- a/babel/messages/pofile.py
+++ b/babel/messages/pofile.py
@@ -196,8 +196,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