Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Private Member Functions
CMFDiffTool.TextDiff.TextDiff Class Reference
Inheritance diagram for CMFDiffTool.TextDiff.TextDiff:
Inheritance graph
[legend]
Collaboration diagram for CMFDiffTool.TextDiff.TextDiff:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def unified_diff
def html_diff

Static Public Attributes

string meta_type = "Lines Diff"

Private Member Functions

def _parseField

Detailed Description

Text difference

Definition at line 5 of file TextDiff.py.


Member Function Documentation

def CMFDiffTool.TextDiff.TextDiff._parseField (   self,
  value 
) [private]
Parse a field value in preparation for diffing

Definition at line 10 of file TextDiff.py.

00010 
00011     def _parseField(self, value):
00012         """Parse a field value in preparation for diffing"""
00013         # Split the text into a list for diffs
00014         return value.split('\n')

Here is the caller graph for this function:

def CMFDiffTool.TextDiff.TextDiff.html_diff (   self,
  context = True,
  wrapcolumn = 40 
)
Return an HTML table showing differences

Definition at line 21 of file TextDiff.py.

00021 
00022     def html_diff(self, context=True, wrapcolumn=40):
00023         """Return an HTML table showing differences"""
00024         a = [str(i) for i in self._parseField(self.oldValue)]
00025         b = [str(i) for i in self._parseField(self.newValue)]
00026         vis_diff = difflib.HtmlDiff(wrapcolumn=wrapcolumn)
00027         return vis_diff.make_table(a, b, self.id1, self.id2, context=context)
00028 
00029 InitializeClass(TextDiff)

Here is the call graph for this function:

Return a unified diff

Definition at line 15 of file TextDiff.py.

00015 
00016     def unified_diff(self):
00017         """Return a unified diff"""
00018         a = [str(i) for i in self._parseField(self.oldValue)]
00019         b = [str(i) for i in self._parseField(self.newValue)]
00020         return '\n'.join(difflib.unified_diff(a, b, self.id1, self.id2))

Here is the call graph for this function:


Member Data Documentation

string CMFDiffTool.TextDiff.TextDiff.meta_type = "Lines Diff" [static]

Definition at line 8 of file TextDiff.py.


The documentation for this class was generated from the following file: