reviewboard.diffviewer.renderers¶
-
class
DiffRenderer
(diff_file, chunk_index=None, highlighting=False, collapse_all=True, lines_of_context=None, extra_context=None, allow_caching=True, template_name=u'diffviewer/diff_file_fragment.html', show_deleted=False)[source]¶ Bases:
object
Renders a file’s diffs.
A DiffRenderer is constructed as needed and set up for render, and then thrown away. The rendered diff can show that of a whole file (in a collapsed or fully expanded state), or a particular chunk within a file.
The rendered diff will be optimistically pulled out of cache, if it exists. Otherwise, a new one will be rendered and placed in the cache.
The diff_file (from get_diff_files) is the only required parameter. The renderer may modify the contents of this, and should make a copy if it needs to be left untouched.
Note that any of the render functions are meant to be called only once per DiffRenderer. It will alter the state of the renderer, possibly disrupting future render calls.
-
__init__
(diff_file, chunk_index=None, highlighting=False, collapse_all=True, lines_of_context=None, extra_context=None, allow_caching=True, template_name=u'diffviewer/diff_file_fragment.html', show_deleted=False)[source]¶ x.__init__(…) initializes x; see help(type(x)) for signature
-
render_to_string
(request)[source]¶ Returns the diff as a string.
The resulting diff may optimistically be pulled from the cache, if not rendering a custom line range. This makes diff rendering very quick.
If operating with a cache, and the diff doesn’t exist in the cache, it will be stored after render.
-