#NEWLINE# def update_urls( urls , content_type , object_id ) : #NEWLINE# #INDENT# new_urls = new_links = 0 #NEWLINE# for ( field , link_text , url ) in urls : #NEWLINE# #INDENT# if ( ( url is not None ) and url . startswith ( '#' ) ) : #NEWLINE# #INDENT# instance = content_type . get_object_for_this_type ( id = object_id ) #NEWLINE# url = ( instance . get_absolute_url ( ) + url ) #NEWLINE# #UNINDENT# if ( len ( url ) > MAX_URL_LENGTH ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# ( url , url_created ) = Url . objects . get_or_create ( url = url ) #NEWLINE# ( link , link_created ) = Link . objects . get_or_create ( url = url , field = field , text = link_text , content_type = content_type , object_id = object_id ) #NEWLINE# url . still_exists = True #NEWLINE# url . save ( ) #NEWLINE# new_urls += url_created #NEWLINE# new_links += link_created #NEWLINE# #UNINDENT# return ( new_urls , new_links )