#NEWLINE# def create_record( self , name , zone , type , data , extra = None ) : #NEWLINE# #INDENT# "\n        Create a new record.\n\n        :param name: Record name without the domain name (e.g. www).\n                     Note: If you want to create a record for a base domain\n                     name, you should specify empty string ('') for this\n                     argument.\n        :type  name: ``str``\n\n        :param zone: Zone where the requested record is created.\n        :type  zone: :class:`Zone`\n\n        :param type: DNS record type (A, MX, TXT).\n        :type  type: :class:`RecordType`\n\n        :param data: Data for the record (depends on the record type).\n        :type  data: ``str``\n\n        :param extra: Extra attributes (driver specific, e.g. 'prio' or 'ttl').\n                      (optional)\n        :type extra: ``dict``\n\n        :rtype: :class:`Record`\n        " #NEWLINE# action = '/app/dns/dyndns.jsp?' #NEWLINE# if name : #NEWLINE# #INDENT# record_name = ( ( name + '.' ) + zone . domain ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# record_name = zone . domain #NEWLINE# #UNINDENT# params = { #NEWLINE# #INDENT# 'action' : 'SET' , #NEWLINE# 'name' : record_name , #NEWLINE# 'value' : data , #NEWLINE# 'type' : type , #NEWLINE# #UNINDENT# } #NEWLINE# if ( ( type == 'MX' ) and ( extra is not None ) ) : #NEWLINE# #INDENT# params [ 'prio' ] = extra . get ( 'prio' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# response = self . connection . request ( action = action , params = params ) #NEWLINE# #UNINDENT# except ZonomiException : #NEWLINE# #INDENT# e = sys . exc_info ( ) [ 1 ] #NEWLINE# if ( ( 'ERROR: No zone found for %s' % record_name ) in e . message ) : #NEWLINE# #INDENT# raise ZoneDoesNotExistError ( zone_id = zone . id , driver = self , value = e . message ) #NEWLINE# #UNINDENT# raise e #NEWLINE# #UNINDENT# if ( ( len ( response . objects ) != 0 ) and ( response . objects [ 0 ] . get ( 'skipped' ) == 'unchanged' ) ) : #NEWLINE# #INDENT# raise RecordAlreadyExistsError ( record_id = name , driver = self , value = '' ) #NEWLINE# #UNINDENT# if ( 'DELETED' in response . objects ) : #NEWLINE# #INDENT# for el in response . objects [ : 2 ] : #NEWLINE# #INDENT# if ( el . get ( 'content' ) == data ) : #NEWLINE# #INDENT# response . objects = [ el ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# records = self . _to_records ( response . objects , zone = zone ) #NEWLINE# return records [ 0 ]