1
2 '''
3 Implementation of base Transformer class.
4
5 @author: Michael Eddington
6 @version: $Id: transformer.py 872 2008-05-12 17:56:54Z meddingt $
7 '''
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
38 '''
39 Fixup of values in the data model. This is done using by keeping
40 an internal list of references that can be resolved during
41 fixup(). Helper functions are provided in this base class for
42 resolving elements in the data model.
43 '''
44
46 '''
47 Create fixup object
48 '''
49 self.context = None
50 self.isInSelf = False
51
53 '''
54 Wrapper around fixup() to prevent endless recurtion. Please
55 do not override me :)
56 '''
57
58 if not self.isInSelf:
59 try:
60 self.isInSelf = True
61 return self.fixup()
62 finally:
63 self.isInSelf = False
64
65 else:
66 return None
67
69 '''
70 Perform the required fixup. OVERRIDE ME!
71 '''
72
73 raise Exception("Error: Fixup not implemented yet!")
74
76 '''
77 DEPRICATED!
78
79 Use self.context.findDataElementByName(name) instead!
80
81 Internal helper method that will locate a data element in
82 the data model by it's name. We will search starting at
83 our current data element's node level and look down then
84 up for the requested node.
85
86 To be more specific about a node you can use the dotted
87 name "Element1.ELement2".
88 '''
89
90 if self.context == None:
91 raise Exception("Error: Fixup tried to use _findDataElementByName but we have no context!")
92
93 return self.context.findDataElementByName(name)
94
96 '''
97 DEPRICATED!
98
99 Use self.context.getRootOfDataMap() instead!
100
101 Inernal helper method that returns the root of the current
102 data model.
103 '''
104
105 return self.context.getRootOfDataMap()
106
107
108
109