wuttaweb.diffs¶
Tools for displaying simple data diffs
- class wuttaweb.diffs.VersionDiff(config, version, **kwargs)[source]¶
Special diff class for use with version history views. While based on
WebDiff, this class uses a different signature for the constructor.- Parameters:
config – The app config object.
version – Reference to a Continuum version record object.
**kwargs – Remaining kwargs are passed as-is to the
WebDiffconstructor.
- render_version_value(version, field, value)[source]¶
Render the cell value HTML for a given version + field.
This method is used to render both sides of the diff (old + new values). It will just render the field value using a monospace font by default. However:
If the field is involved in a mapper relationship (i.e. it is the “foreign key” to a related table), the logic here will also (try to) traverse that show display text for the related object (if found).
- Parameters:
version – Reference to the Continuum version object.
field – Name of the field, as string.
value – Raw value for the field, as obtained from the version object.
- Returns:
Rendered cell value as HTML literal
- class wuttaweb.diffs.WebDiff(config, old_data: dict, new_data: dict, fields: list = None, nature='update', old_color='#ffebe9', new_color='#dafbe1', cell_padding=None)[source]¶
Simple diff class for the web app.
This is based on the
Diffclass; it just tweaksrender_html()to use the web template lookup engine.- cell_padding = None¶