# HG changeset patch # User neko259 # Date 2015-08-24 13:24:58 # Node ID f9fccc44f7df799621b9f25edab8ca687c6902a0 # Parent 8d3d048692d81a588b2ff090bce5d1efd1842bc3 Refactored attachment viewer getting method diff --git a/boards/models/attachment/__init__.py b/boards/models/attachment/__init__.py --- a/boards/models/attachment/__init__.py +++ b/boards/models/attachment/__init__.py @@ -53,11 +53,11 @@ class Attachment(models.Model): file_viewer = None for viewer in get_viewers(): if viewer.supports(self.mimetype): - file_viewer = viewer(self.file, self.mimetype) + file_viewer = viewer break if file_viewer is None: - file_viewer = AbstractViewer(self.file, self.mimetype) + file_viewer = AbstractViewer - return file_viewer.get_view() + return file_viewer(self.file, self.mimetype).get_view()