#NEWLINE# def release_dynamic_segment( self , session , segment_id ) : #NEWLINE# #INDENT# 'Delete a dynamic segment.' #NEWLINE# segment = db . get_segment_by_id ( session , segment_id ) #NEWLINE# if segment : #NEWLINE# #INDENT# driver = self . drivers . get ( segment . get ( api . NETWORK_TYPE ) ) #NEWLINE# if driver : #NEWLINE# #INDENT# driver . obj . release_segment ( session , segment ) #NEWLINE# db . delete_network_segment ( session , segment_id ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# LOG . error ( _LE ( "Failed to release segment '%s' because network type is not supported." ) , segment ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# LOG . debug ( 'No segment found with id %(segment_id)s' , segment_id )