xtuml/meta.py
def default_value(self, type_name):
        '''
        Obtain the default value for some *type name*.
        '''
        uname = type_name.upper()
        if   uname == 'BOOLEAN':
            return False
            
        elif uname == 'INTEGER':
            return 0
            
        elif uname == 'REAL':
            return 0.0
            
        elif uname == 'STRING':
            return ''
            
        elif uname == 'UNIQUE_ID':
            if self.metamodel:
                return next(self.metamodel.id_generator)
            else:
                return None
        else:
            raise MetaException("Unknown type named '%s'" % type_name)
def default_value(self, type_name):
        '''
        Obtain the default value for some *type name*.
        '''
        uname = type_name.upper()
        if   uname == 'BOOLEAN':
            return False
            
        elif uname == 'INTEGER':
            return 0
            
        elif uname == 'REAL':
            return 0.0
            
        elif uname == 'STRING':
            return ''
            
        elif uname == 'UNIQUE_ID':
            if self.metamodel:
                return next(self.metamodel.id_generator)
            else:
                return None
        else:
            raise MetaException("Unknown type named '%s'" % type_name)
def default_value ( self , type_name ) : uname = type_name . upper ( ) if uname == 'BOOLEAN' : return False elif uname == 'INTEGER' : return 0 elif uname == 'REAL' : return 0.0 elif uname == 'STRING' : return '' elif uname == 'UNIQUE_ID' : if self . metamodel : return next ( self . metamodel . id_generator ) else : return None else : raise MetaException ( "Unknown type named '%s'" % type_name )
Obtain the default value for some *type name*.
Obtain the default value for some * type name * .