#NEWLINE# def create_content_if_changed( self , page , language , ctype , body ) : #NEWLINE# #INDENT# 'Create a :class:`Content <pages.models.Content>` for a particular\n        page and language only if the content has changed from the last\n        time.\n\n        :param page: the concerned page object.\n        :param language: the wanted language.\n        :param ctype: the content type.\n        :param body: the content of the Content object.\n        ' #NEWLINE# try : #NEWLINE# #INDENT# content = self . filter ( page = page , language = language , type = ctype ) . latest ( 'creation_date' ) #NEWLINE# if ( content . body == body ) : #NEWLINE# #INDENT# return content #NEWLINE# #UNINDENT# #UNINDENT# except body . model . DoesNotExist : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# content = self . create ( page = page , language = language , body = body , type = ctype ) #NEWLINE# if settings . PAGE_CONTENT_REVISION_DEPTH : #NEWLINE# #INDENT# oldest_content = self . filter ( page = page , language = language , type = ctype ) . order_by ( '-creation_date' ) [ settings . PAGE_CONTENT_REVISION_DEPTH : ] #NEWLINE# for c in oldest_content : #NEWLINE# #INDENT# c . delete ( ) #NEWLINE# #UNINDENT# #UNINDENT# return content