Ignore:
Timestamp:
06/01/12 13:34:40 (8 years ago)
Author:
mnagni
Message:

Now
1) does not generate classes which do not respect python syntax
2) transform the attributes name to a python complaint syntax (substitute an underscore)
3) better import of the externallyMapped classes

Still generate double (append a copy) to some classes.

File:
1 edited

Legend:

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

    r8043 r8048  
    1414${stereotype.name}#elseif($superclasses.size() > 0) 
    1515#foreach( $classModel in $superclasses) 
    16 ${classModel.associatedClass.name}#if($foreach.hasNext),#end 
     16##${classModel.associatedClass.name}#if($foreach.hasNext),#end 
     17${vh.getMappedClass(${classModel.associatedClass.name})}#if($foreach.hasNext),#end 
    1718#end 
    1819#end 
     
    2122#macro( asEnumeration $asEnumeration) 
    2223#foreach($item in $asEnumeration.simpleKeyValues) 
    23 ${tab}en_${item.key.replaceAll("[()]", "")} = "${item.value}"  
     24${tab}en_${vh.transformToPythonName($item.key)} = "${item.value}"  
    2425#end 
    2526#end 
     
    2728#macro( asCodeList $asCodeList) 
    2829#foreach($item in $asCodeList.simpleKeyValues) 
    29 ${tab}cl_${item.key.replaceAll("[()]", "")} = "${item.value}"  
     30${tab}cl_${vh.transformToPythonName($item.key)} = "${item.value}"  
    3031#end 
    3132#end 
     
    3738#macro (unionDictionary $attributeModel) 
    3839#foreach($item in $attributeModel) 
    39 '${item.name}':#substituteClassType(${item.associatedType.associatedClass.name})#if($foreach.hasNext),#end   
     40'${item.name}':${vh.getMappedClass(${item.associatedType.associatedClass.name})}#if($foreach.hasNext),#end   
    4041#end 
    4142#end 
     
    4445#macro( importing $toImport) 
    4546#foreach( $key in $toImport.keySet())    
    46 from $key import #foreach( $item in $toImport.get($key)) $item#if($foreach.hasNext),#end 
     47from $key import #foreach( $item in $toImport.get($key)) $item#if($foreach.hasNext),#end #end 
    4748 
    48 #end 
    4949#end 
    5050#end 
     
    8080#if($parents) 
    8181#foreach( $parent in $parents) 
    82 ${tab}${tab}self._${parent.associatedClass.name.toLowerCase()} = ${parent.associatedClass.name}()        
     82${tab}${tab}self._${parent.associatedClass.name.toLowerCase()} = ${vh.getMappedClass(${parent.associatedClass.name})}()          
    8383#end 
    8484#end 
Note: See TracChangeset for help on using the changeset viewer.