Ignore:
Timestamp:
04/01/12 10:35:54 (8 years ago)
Author:
mnagni
Message:

Works fine. Now initializes also the python classes attributes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/xmi2sqlalchemy/trunk/src/main/resources/velocity/python/pythonClass.vm

    r8040 r8043  
    5252#macro (getter $attribute) 
    5353#set ( $methodName = "$display.capitalize( $attribute.name )") 
    54 #if($attribute.parentName) 
     54#if($attribute.getParentName()) 
    5555${tab}@property 
    5656${tab}def ${attribute.name}(self): 
    57 ${tab}${tab}return self._${attribute.parentName.toLowerCase()}.${attribute.name} 
     57${tab}${tab}return self._${attribute.getParentName().toLowerCase()}.${attribute.name} 
    5858#end 
    5959#end 
     
    6161#macro (setter $attribute) 
    6262#set ( $methodName = "$display.capitalize( $attribute.name )") 
    63 #if($attribute.parentName) 
     63#if($attribute.getParentName()) 
    6464${tab}@${attribute.name}.setter 
    6565${tab}def ${attribute.name}(self, value): 
    66 ${tab}${tab}${tab} self._${attribute.parentName.toLowerCase()}.${attribute.name} = value 
     66${tab}${tab}${tab} self._${attribute.getParentName().toLowerCase()}.${attribute.name} = value 
    6767#end 
    6868#end 
     
    8282${tab}${tab}self._${parent.associatedClass.name.toLowerCase()} = ${parent.associatedClass.name}()        
    8383#end 
     84#end 
    8485#foreach($attribute in $attributes) 
    85 ${tab}${tab}self.${attribute.name} 
     86${tab}${tab}self.${attribute.name} #if($attribute.hasMultiplicity()) = [] 
     87#else = None 
    8688#end 
    8789#end 
Note: See TracChangeset for help on using the changeset viewer.