def sized_preview_jpg_revision(self,
                                context,
                                request: TracimRequest,
                                hapic_data=None):  # nopep8
     """
     Obtain resized jpg preview of a specific revision of content.
     """
     app_config = request.registry.settings['CFG']
     api = ContentApi(
         current_user=request.current_user,
         session=request.dbsession,
         config=app_config,
     )
     content = api.get_one(hapic_data.path.content_id,
                           content_type=ContentType.Any)
     revision = api.get_one_revision(
         revision_id=hapic_data.path.revision_id, content=content)
     jpg_preview_path = api.get_jpg_preview_path(
         content_id=content.content_id,
         revision_id=revision.revision_id,
         page=hapic_data.query.page,
         height=hapic_data.path.height,
         width=hapic_data.path.width,
     )
     return FileResponse(jpg_preview_path)
 def preview_jpg(self, context, request: TracimRequest, hapic_data=None):
     """
     Obtain normally sied jpg preview of last revision of content.
     """
     app_config = request.registry.settings['CFG']
     api = ContentApi(
         current_user=request.current_user,
         session=request.dbsession,
         config=app_config,
     )
     content = api.get_one(hapic_data.path.content_id,
                           content_type=ContentType.Any)
     allowed_dim = api.get_jpg_preview_allowed_dim()
     jpg_preview_path = api.get_jpg_preview_path(
         content_id=content.content_id,
         revision_id=content.revision_id,
         page=hapic_data.query.page,
         width=allowed_dim.dimensions[0].width,
         height=allowed_dim.dimensions[0].height,
     )
     return FileResponse(jpg_preview_path)