def prev_version(self, current_doc, name): _differ = dmp() result = "" current_text = current_doc.get(name, "") patch = self[name] # result = _differ.diff_main(old_text, value) result = _differ.patch_fromText(patch) result = _differ.patch_apply(result, current_text) return result
def add_diff(self, original_doc, name, value): _differ = dmp() if isinstance(value, basestring): old_text = original_doc.get(name, "") # result = _differ.diff_main(old_text, value) result = _differ.patch_make(value, old_text) result = _differ.patch_toText(result) self[name] = result original_doc[name] = value
def __init__(self): self.previous_text = "" self.editor = MajesticEditor() self.dmp = dmp()
def get_html(self, key): _differ = dmp() return _differ.make_prettyHtml(self[key])