addons14/document_page/models/document_page_history.py
def _get_diff(self, v1, v2):
        """Return the difference between two version of document version."""
        text1 = v1 and self.browse(v1).content or ""
        text2 = v2 and self.browse(v2).content or ""
        # Include line breaks to make it more readable
        # TODO: consider using a beautify library directly on the content
        text1 = text1.replace("</p><p>", "</p>\r\n<p>")
        text2 = text2.replace("</p><p>", "</p>\r\n<p>")
        line1 = text1.splitlines(True)
        line2 = text2.splitlines(True)
        if line1 == line2:
            return _("There are no changes in revisions.")
        else:
            diff = difflib.HtmlDiff()
            return diff.make_table(
                line1,
                line2,
                "Revision-{}".format(v1),
                "Revision-{}".format(v2),
                context=True,
            )
Return the difference between two version of document version.
Return the difference between two version of document version.
Return the difference between two version of document version .
def _get_diff(self, v1, v2):
        text1 = v1 and self.browse(v1).content or ""
        text2 = v2 and self.browse(v2).content or ""
        text1 = text1.replace("</p><p>", "</p>\r\n<p>")
        text2 = text2.replace("</p><p>", "</p>\r\n<p>")
        line1 = text1.splitlines(True)
        line2 = text2.splitlines(True)
        if line1 == line2:
            return _("There are no changes in revisions.")
        else:
            diff = difflib.HtmlDiff()
            return diff.make_table(
                line1,
                line2,
                "Revision-{}".format(v1),
                "Revision-{}".format(v2),
                context=True,
            )
def _get_diff ( self , v1 , v2 ) : text1 = v1 and self . browse ( v1 ) . content or "" text2 = v2 and self . browse ( v2 ) . content or "" text1 = text1 . replace ( "</p><p>" , "</p>\r\n<p>" ) text2 = text2 . replace ( "</p><p>" , "</p>\r\n<p>" ) line1 = text1 . splitlines ( True ) line2 = text2 . splitlines ( True ) if line1 == line2 : return _ ( "There are no changes in revisions." ) else : diff = difflib . HtmlDiff ( ) return diff . make_table ( line1 , line2 , "Revision-{}" . format ( v1 ) , "Revision-{}" . format ( v2 ) , context = True , )
Return the difference between two version of document version.
Return the difference between two version of document version .
"""Return the difference between two version of document version.""" # Include line breaks to make it more readable # TODO: consider using a beautify library directly on the content
self
v1
v2