#NEWLINE# @ classmethod #NEWLINE# def _create_ip_ranges_on_notation( cls , instance ) : #NEWLINE# #INDENT# "Create IP-address ranges basing on 'notation' field of 'meta' field\n\n        :param instance: NetworkGroup instance\n        :type instance: models.NetworkGroup\n        :return: None\n        " #NEWLINE# notation = instance . meta . get ( 'notation' ) #NEWLINE# if notation : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if ( notation == 'cidr' ) : #NEWLINE# #INDENT# cls . _update_range_from_cidr ( instance , IPNetwork ( instance . cidr ) . cidr , instance . meta . get ( 'use_gateway' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( notation == 'ip_ranges' ) and instance . meta . get ( 'ip_range' ) ) : #NEWLINE# #INDENT# cls . _set_ip_ranges ( instance , [ notation . meta [ 'ip_range' ] ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise errors . CannotCreate ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except ( errors . CannotCreate , IndexError , TypeError ) : #NEWLINE# #INDENT# raise errors . CannotCreate ( "IPAddrRange object cannot be created for network '{0}' with notation='{1}', ip_range='{2}'" . format ( instance . name , instance . meta . get ( 'notation' ) , instance . meta . get ( 'ip_range' ) ) )