| Trees | Indices | Help | 
|---|
| 
       | 
  
 1  # 
 2  # slumNode -  classNode that evaluates the slum class stored in a node and 
 3  #                         makes its object available as self.slum 
 4  # 
 5  #    Copyright (C) 2008 - Roberto Hradec 
 6  # 
 7  # --------------------------------------------------------------------------- 
 8  #        This file is part of SLUM. 
 9  # 
10  #    SLUM is free software: you can redistribute it and/or modify 
11  #    it under the terms of the GNU General Public License as published by 
12  #    the Free Software Foundation, either version 3 of the License, or 
13  #    (at your option) any later version. 
14  # 
15  #    SLUM is distributed in the hope that it will be useful, 
16  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
17  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
18  #    GNU General Public License for more details. 
19  # 
20  #    You should have received a copy of the GNU General Public License 
21  #    along with SLUM.  If not, see <http://www.gnu.org/licenses/>. 
22  # ------------------------------------------------------------ 
23   
24   
25  from classNode import * 
26  import slum 
27   
28  global slumNodeCache 
29  slumNodeCache={} 
30   
32          ''' 
33                  derivated from classNode, this class adds the advantage of evaluating an slum attribute automaticaly, if 
34                  one is present in a node. 
35                  Instead of returning the string value of the slum attribute, it returns the evaluated class object 
36                  from the code in the string attribute. 
37          ''' 
39                  classNode.__init__(self, node, data) 
40                  self.classe = None 
41                  if classNode.has_key(self, 'slum'): 
42                          self.classe = classNode.__getitem__(self,'slum') 
43                          classNode._dict.__setitem__(self.classe, 'edited', False) 
44                  self.evalSlumClass( forceSlumEval ) 
46                  if self.classe: 
47   
48                          if not slumNodeCache.has_key(self.node) or forceSlumEval: 
49                                  slumNodeCache[self.node] = slum.evalSlumClass(self.classe['code'], self.classe['name']) 
50   
51                          self.slum = slumNodeCache[self.node] 
52                          self.slumParameters = self.slum.parameters() 
53   
54                          # check if file md5 matches the one stored in the node. 
55   
61   
| Trees | Indices | Help | 
|---|
| Generated by Epydoc 3.0.1 on Thu Oct 28 16:21:55 2010 | http://epydoc.sourceforge.net |