#NEWLINE# def _to_zone_elem( self , domain = None , type = None , ttl = None , extra = None ) : #NEWLINE# #INDENT# zone_elem = ET . Element ( 'zone' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# if domain : #NEWLINE# #INDENT# domain_elem = ET . SubElement ( zone_elem , 'domain' ) #NEWLINE# domain_elem . text = domain #NEWLINE# #UNINDENT# if type : #NEWLINE# #INDENT# ns_type_elem = ET . SubElement ( zone_elem , 'ns-type' ) #NEWLINE# if ( type == 'master' ) : #NEWLINE# #INDENT# ns_type_elem . text = 'pri_sec' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( type == 'slave' ) : #NEWLINE# #INDENT# if ( ( not extra ) or ( 'ns1' not in extra ) ) : #NEWLINE# #INDENT# raise LibcloudError ( ( 'ns1 extra attribute is required ' + 'when zone type is slave' ) , driver = self ) #NEWLINE# #UNINDENT# ns_type_elem . text = 'sec' #NEWLINE# ns1_elem = ET . SubElement ( zone_elem , 'ns1' ) #NEWLINE# ns1_elem . text = extra [ 'ns1' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( type == 'std_master' ) : #NEWLINE# #INDENT# if ( ( not extra ) or ( 'slave-nameservers' not in extra ) ) : #NEWLINE# #INDENT# raise LibcloudError ( ( ( 'slave-nameservers extra ' + 'attribute is required whenzone ' ) + 'type is std_master' ) , driver = self ) #NEWLINE# #UNINDENT# ns_type_elem . text = 'pri' #NEWLINE# slave_nameservers_elem = ET . SubElement ( zone_elem , 'slave-nameservers' ) #NEWLINE# slave_nameservers_elem . text = extra [ 'slave-nameservers' ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ttl : #NEWLINE# #INDENT# default_ttl_elem = ET . SubElement ( zone_elem , 'default-ttl' ) #NEWLINE# default_ttl_elem . text = str ( ttl ) #NEWLINE# #UNINDENT# if ( extra and ( 'tag-list' in extra ) ) : #NEWLINE# #INDENT# tags = extra [ 'tag-list' ] #NEWLINE# tags_elem = ET . SubElement ( zone_elem , 'tag-list' ) #NEWLINE# tags_elem . text = ' ' . join ( tags ) #NEWLINE# #UNINDENT# return zone_elem