Package pyx12 :: Module map_override
[hide private]

Source Code for Module pyx12.map_override

 1  ###################################################################### 
 2  # Copyright (c) 2001-2005 Kalamazoo Community Mental Health Services, 
 3  #   John Holland <jholland@kazoocmh.org> <john@zoner.org> 
 4  # All rights reserved. 
 5  # 
 6  # This software is licensed as described in the file LICENSE.txt, which 
 7  # you should have received as part of this distribution. 
 8  # 
 9  ###################################################################### 
10   
11  #    $Id: map_override.py 961 2007-03-23 21:35:20Z johnholland $ 
12   
13  """ 
14  Apply local overrides to the current map. 
15  Overrides defined in a xml document.  
16  """ 
17   
18  import libxml2 
19  import errors 
20   
21   
22 -class map_override(object):
23 """ 24 Apply local overrides to the current map. Overrides defined in a xml document. 25 """
26 - def __init__(self, map_root, override_file, icvn, vriic, fic):
27 map_file = None 28 try: 29 reader = libxml2.newTextReaderFilename(map_file) 30 except: 31 raise errors.EngineError, 'Map file not found: %s' % (map_file) 32 33 NodeType = {'element_start': 1, 'element_end': 15, 'attrib': 2, \ 34 'text': 3, 'CData': 4, 'entity_ref': 5, 'entity_decl':6, \ 35 'pi': 7, 'comment': 8, 'doc': 9, 'dtd': 10, 'doc_frag': 11, \ 36 'notation': 12} 37 38 while reader.Read(): 39 #processNode(reader) 40 if reader.NodeType() == NodeType['element_start'] and reader.Name() == 'version': 41 while reader.MoveToNextAttribute(): 42 if reader.Name() == 'icvn': 43 icvn = reader.Value() 44 45 if reader.NodeType() == NodeType['element_end'] and reader.Name() == 'version': 46 icvn = None 47 48 if reader.NodeType() == NodeType['element_start'] and reader.Name() == 'map': 49 file_name = '' 50 while reader.MoveToNextAttribute(): 51 if reader.Name() == 'vriic': 52 vriic = reader.Value() 53 elif reader.Name() == 'fic': 54 fic = reader.Value() 55 56 if reader.NodeType() == NodeType['element_end'] and reader.Name() == 'map': 57 #self.maps.append((icvn, vriic, fic, file_name)) 58 vriic = None 59 fic = None 60 file_name = None 61 62 if reader.NodeType() == NodeType['text']: 63 file_name = reader.Value()
64
65 - def _set_value(self, map_root, path, variable, value):
66 pass
67
68 - def _append_value(self, map_root, path, variable, value):
69 pass
70
71 - def _reset_list(self, map_root, path, variable, value):
72 pass
73