#NEWLINE# def sync_record( self , cp ) : #NEWLINE# #INDENT# logger . info ( ( "sync'ing content provider %s" % str ( spid ) ) , extra = cp . tologdict ( ) ) #NEWLINE# account_name = self . make_account_name ( cp . name ) #NEWLINE# if ( ( not cp . serviceProvider ) or ( not cp . serviceProvider . service_provider_id ) ) : #NEWLINE# #INDENT# raise Exception ( ( 'ContentProvider %s is linked to a serviceProvider with no id' % str ( cp ) ) ) #NEWLINE# #UNINDENT# spid = cp . serviceProvider . service_provider_id #NEWLINE# cp_dict = { #NEWLINE# #INDENT# 'account' : account_name , #NEWLINE# 'name' : cp . name , #NEWLINE# 'enabled' : cp . enabled , #NEWLINE# #UNINDENT# } #NEWLINE# if ( not cp . content_provider_id ) : #NEWLINE# #INDENT# cp_dict [ 'service_provider_id' ] = spid #NEWLINE# id = self . client . onev . Create ( 'ContentProvider' , cp_dict ) #NEWLINE# cp . content_provider_id = id #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . client . onev . Update ( 'ContentProvider' , cp . content_provider_id , cp_dict ) #NEWLINE# #UNINDENT# cp . save ( )