wuttaweb.diffs¶
Tools for displaying simple data diffs
- class wuttaweb.diffs.Diff(old_data: dict, new_data: dict, fields: list = None, nature='update', old_color='#ffebe9', new_color='#dafbe1')[source]¶
Represent / display a basic “diff” between two data records.
You must provide both the “old” and “new” data records, when constructing an instance of this class. Then call
render_html()to display the diff table.- Parameters:
old_data – Dict of “old” data record.
new_data – Dict of “new” data record.
fields – Optional list of field names. If not specified, will be derived from the data records.
nature – What sort of diff is being represented; must be one of:
("create", "update", "delete")old_color – Background color to display for “old/deleted” field data, when applicable.
new_color – Background color to display for “new/created” field data, when applicable.
- class wuttaweb.diffs.VersionDiff(version, **kwargs)[source]¶
Special diff class, for use with version history views. Note that while based on
Diff, this class uses a different signature for the constructor.- Parameters:
version – Reference to a Continuum version record (object).
**kwargs – Remaining kwargs are passed as-is to the
Diffconstructor.