Try to print line no at malformed .po.

bzr revid: p_christ@hol.gr-20081211175936-642lc4ytppjhmkve
This commit is contained in:
P. Christeas 2008-12-11 19:59:36 +02:00
parent 101afd1a4f
commit 77a1e920d9
1 changed files with 5 additions and 1 deletions

View File

@ -77,6 +77,7 @@ class TinyPoFile(object):
def __iter__(self):
self.buffer.seek(0)
self.lines = self._get_lines()
self.lines_count = len(self.lines);
self.first = True
self.tnrs= []
@ -91,6 +92,9 @@ class TinyPoFile(object):
lines.append('') # ensure that the file ends with at least an empty line
return lines
def cur_line(self):
return (self.lines_count - len(self.lines))
def next(self):
def unquote(str):
return str[1:-1].replace("\\n", "\n") \
@ -133,7 +137,7 @@ class TinyPoFile(object):
while not line.startswith('msgstr'):
if not line:
raise Exception('malformed file')
raise Exception('malformed file at %d'% self.cur_line())
source += unquote(line)
line = self.lines.pop(0).strip()