Kaydet (Commit) 551a13f5 authored tarafından Miklos Vajna's avatar Miklos Vajna

Give better error message on invalid sdf input

üst ea4e833c
...@@ -52,9 +52,14 @@ class Entry: ...@@ -52,9 +52,14 @@ class Entry:
self.keys = [] self.keys = []
# 10..13 are translation types # 10..13 are translation types
for idx in range(10, 14): for idx in range(10, 14):
if len(self.items[idx]): try:
t = {10:'text', 12:'quickhelptext', 13:'title'}[idx] if len(self.items[idx]):
self.keys.append((idx, self.sdf2po("%s#%s.%s%s" % (path[-1], self.items[4], prefix, t)))) t = {10:'text', 12:'quickhelptext', 13:'title'}[idx]
self.keys.append((idx, self.sdf2po("%s#%s.%s%s" % (path[-1], self.items[4], prefix, t))))
except IndexError:
print("Tried to access field #%d in sdf file, but no such column! Broken sdf file?" % idx)
print("Fields: %s" % self.items)
sys.exit(1)
def translate(self, translations): def translate(self, translations):
"""Translates text in the entry based on translations.""" """Translates text in the entry based on translations."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment