#NEWLINE# def delete_subnetpool( self , context , id ) : #NEWLINE# #INDENT# 'Delete a subnetpool.' #NEWLINE# with context . session . begin ( subtransactions = True ) : #NEWLINE# #INDENT# subnetpool = self . _get_subnetpool ( context , id ) #NEWLINE# subnets = self . _get_subnets_by_subnetpool ( context , id ) #NEWLINE# if subnets : #NEWLINE# #INDENT# reason = _ ( 'Subnet pool has existing allocations' ) #NEWLINE# raise n_exc . SubnetPoolDeleteError ( reason = reason ) #NEWLINE# #UNINDENT# context . session . delete ( subnetpool )