1
#########################################################################
4
# copyright 2002 Paul Henry Tremblay #
6
# This program is distributed in the hope that it will be useful, #
7
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
8
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
9
# General Public License for more details. #
11
# You should have received a copy of the GNU General Public License #
12
# along with this program; if not, write to the Free Software #
13
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA #
17
#########################################################################
22
Return the character map for the given value
26
def __init__(self, bug_handler, char_file):
31
'char_file'--the file with the mappings
40
self.__char_file = char_file
41
self.__bug_handler = bug_handler
43
def get_char_map(self, map):
48
self.__char_file.seek(0)
49
for line in self.__char_file.readlines():
50
if not line.strip(): continue
51
begin_element = '<%s>' % map;
52
end_element = '</%s>' % map
54
if begin_element in line:
57
if end_element in line:
59
fields = line.split(':')
60
fields[1].replace('\\colon', ':')
61
map_dict[fields[1]] = fields[3]
65
msg = 'no map found\n'
66
msg += 'map is "%s"\n'%(map,)
67
raise self.__bug_handler, msg