Update get_char_map

This commit is contained in:
Sengian 2011-01-06 22:53:38 +01:00
parent bbaecb4007
commit 18df9457bb

View File

@ -43,16 +43,16 @@ class GetCharMap:
def get_char_map(self, map): def get_char_map(self, map):
if map == 'ansicpg0': if map == 'ansicpg0':
map = 'ansicpg1250' map = 'ansicpg1250'
found_map = 0 found_map = False
map_dict = {} map_dict = {}
self.__char_file.seek(0) self.__char_file.seek(0)
for line in self.__char_file.readlines(): for line in self.__char_file:
if not line.strip(): continue if not line.strip(): continue
begin_element = '<%s>' % map; begin_element = '<%s>' % map;
end_element = '</%s>' % map end_element = '</%s>' % map
if not found_map: if not found_map:
if begin_element in line: if begin_element in line:
found_map = 1 found_map = True
else: else:
if end_element in line: if end_element in line:
break break
@ -62,8 +62,7 @@ class GetCharMap:
if not found_map: if not found_map:
msg = 'no map found\n' msg = _('no map found\nmap is "%s"\n') %(map,)
msg += 'map is "%s"\n'%(map,)
raise self.__bug_handler, msg raise self.__bug_handler, msg
return map_dict return map_dict