• 
      

    Introducing Thumbnail Integration through Extensions

    Review Request #3614 — Created Dec. 2, 2012 and submitted — Latest diff uploaded

    Information

    Review Board
    master

    Reviewers

    ReviewBoard Extensions can now define how to create thumbnails
    for specified file attachment mimetypes.
    
    Added FileAttachmentThumbnailHook to generalize a hook point for
    all files of all mimetypes. Mimetype Handlers for text-based
    mimetypes can leverage `reviewboard.attachments.mimetypes.TextMimetype`
    by simply overriding `_generate_preview_html` to define how to
    generate the HTML used in the thumbnail, instead of having to
    redefine `get_thumbnail`.
    Test Steps:
    
    - Disabled the registration of XMLMimetype in reviewboard.attachments.__init__ (
    - Verified that XML thumbnails now fall back to raw uncolored text)
    - Copied over the XMLReviewUIExtension from the sample extension branch, and:
      - Added XMLThumbnail.py to define the XMLMimetype class for generating XML thumbnails
      - Modified extensions.py to use the FileAttachmentThumbnailHook to hook XMLMimetype into ReviewBoard to handle XML thumbnails.
    - Verified that the Extension installs without error
    - Verified that Extension-installed XML thumbnails feature work exactly as did before.
    
    (see attached screenshot, disregard the hyperlink lines - that was due to a separate change to master: http://reviews.reviewboard.org/r/3569/)