#NEWLINE# def post( self , request , * args , **kwargs ) : #NEWLINE# #INDENT# '\n        Check if an URL is provided and if trackbacks\n        are enabled on the Entry.\n        If so the URL is registered one time as a trackback.\n        ' #NEWLINE# url = request . POST . get ( 'url' ) #NEWLINE# if ( not url ) : #NEWLINE# #INDENT# return self . get ( request , * args , ** kwargs ) #NEWLINE# #UNINDENT# entry = self . get_object ( ) #NEWLINE# site = Site . objects . get_current ( ) #NEWLINE# if ( not entry . trackbacks_are_open ) : #NEWLINE# #INDENT# return self . render_to_response ( { #NEWLINE# #INDENT# 'error' : ( 'Trackback is not enabled for %s' % entry . title ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# title = ( request . POST . get ( 'title' ) or url ) #NEWLINE# excerpt = ( request . POST . get ( 'excerpt' ) or title ) #NEWLINE# blog_name = ( request . POST . get ( 'blog_name' ) or title ) #NEWLINE# ip_address = request . META . get ( 'REMOTE_ADDR' , None ) #NEWLINE# ( trackback , created ) = comments . get_model ( ) . objects . get_or_create ( content_type = ContentType . objects . get_for_model ( Entry ) , object_pk = entry . pk , site = site , user_url = url , user_name = blog_name , ip_address = ip_address , defaults = { #NEWLINE# #INDENT# 'comment' : excerpt , #NEWLINE# 'submit_date' : timezone . now ( ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# if created : #NEWLINE# #INDENT# trackback . flags . create ( user = get_user_flagger ( ) , flag = TRACKBACK ) #NEWLINE# trackback_was_posted . send ( trackback . __class__ , trackback = trackback , entry = entry ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return self . render_to_response ( { #NEWLINE# #INDENT# 'error' : 'Trackback is already registered' , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# return self . render_to_response ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } )