From patchwork Mon May 7 12:00:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongqin Liu X-Patchwork-Id: 8430 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id B64BE23EAB for ; Mon, 7 May 2012 12:00:19 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 7CD22A186D1 for ; Mon, 7 May 2012 12:00:19 +0000 (UTC) Received: by mail-yx0-f180.google.com with SMTP id l4so5008351yen.11 for ; Mon, 07 May 2012 05:00:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=9utq44TfbzEljT6i5g0u+9OSS4O6+yzAm+uvrsQIrKY=; b=dnCdNc5WY7hup1GU0tsAN+uJQc4LYJvsGUaYbUteNNJFSzbbf2tv/kJCERz9Xa3Lur c5WL/URPPkGWu/0ja4WOwdFi6FpbzSioriy90xkMmtU/13w5cv+xnu0Ta4dwjdbqST0T lp0g+hGAVPCl8f7aMY8ueIMkyjyp/JgPCZ4M8YclsvEG15Xv3qs79k1gRru9tsLeSRoP 2QKe7JM/y1cCStsRGwksqsfvzj802dH73xFzyjWNBrb65w8edx7kXrEwzIFCBdkkcIYX WA6za4qf4Wgq0I9MTu76xPeXVTigCFvVrZiHGHO4CeDTrz1cXwr0x/aIz29DptgfIEmZ TM0w== Received: by 10.50.57.129 with SMTP id i1mr8116018igq.33.1336392019076; Mon, 07 May 2012 05:00:19 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.73.147 with SMTP id q19csp120874ibj; Mon, 7 May 2012 05:00:17 -0700 (PDT) Received: by 10.180.86.194 with SMTP id r2mr27442839wiz.15.1336392017361; Mon, 07 May 2012 05:00:17 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id s1si9167404wiy.19.2012.05.07.05.00.16 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 07 May 2012 05:00:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1SRMbw-0000k4-Pf for ; Mon, 07 May 2012 12:00:16 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id B5ABEE03E6 for ; Mon, 7 May 2012 12:00:16 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-dashboard X-Launchpad-Branch: ~linaro-validation/lava-dashboard/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 314 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dashboard/trunk] Rev 314: merge with the Bug #877984 fix branch Message-Id: <20120507120016.20069.98560.launchpad@ackee.canonical.com> Date: Mon, 07 May 2012 12:00:16 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="15195"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 35b63c726670ce2dd03a26e72ddf0934c68c04d6 X-Gm-Message-State: ALoCoQnSQDur5BrlM2pGY533wZNQDsj3vDYN0Flt87pvvGuMLqPo4dPEJHJAGmabCB49SKnSinxd Merge authors: Yongqin Liu (liuyq0307) Related merge proposals: https://code.launchpad.net/~liuyq0307/lava-dashboard/viem-png2/+merge/104566 proposed by: Yongqin Liu (liuyq0307) review: Approve - Yongqin Liu (liuyq0307) ------------------------------------------------------------ revno: 314 [merge] committer: Yongqin Liu branch nick: lava-dashboard timestamp: Mon 2012-05-07 19:58:23 +0800 message: merge with the Bug #877984 fix branch modified: dashboard_app/templates/dashboard_app/attachment_detail.html dashboard_app/views.py --- lp:lava-dashboard https://code.launchpad.net/~linaro-validation/lava-dashboard/trunk You are subscribed to branch lp:lava-dashboard. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dashboard/trunk/+edit-subscription === modified file 'dashboard_app/templates/dashboard_app/attachment_detail.html' --- dashboard_app/templates/dashboard_app/attachment_detail.html 2011-07-12 02:34:12 +0000 +++ dashboard_app/templates/dashboard_app/attachment_detail.html 2012-05-07 11:51:01 +0000 @@ -7,7 +7,7 @@
@@ -41,6 +41,11 @@ } } }); + {% ifnotequal attachment.mime_type "text/plain" %} + $('#inline_viewer_link').attr('href', "{% url dashboard_app.views.ajax_attachment_viewer attachment.pk %}"); + $('#inline_viewer_link').unbind( ".tabs" ); + {% endifnotequal %} + }); {% endblock %} === modified file 'dashboard_app/views.py' --- dashboard_app/views.py 2012-04-20 22:55:12 +0000 +++ dashboard_app/views.py 2012-05-03 14:39:17 +0000 @@ -1,4 +1,4 @@ -# Copyright (C) 2010 Linaro Limited +# Copyright (C) 2010-2012 Linaro Limited # # Author: Zygmunt Krynicki # @@ -591,16 +591,21 @@ request.user, pk=pk ) + data = attachment.get_content_if_possible( + mirror=request.user.is_authenticated()) if attachment.mime_type == "text/plain": - data = attachment.get_content_if_possible(mirror=request.user.is_authenticated()) + return render_to_response( + "dashboard_app/_ajax_attachment_viewer.html", { + "attachment": attachment, + "lines": data.splitlines() if data else None, + }, + RequestContext(request)) else: - data = None - return render_to_response( - "dashboard_app/_ajax_attachment_viewer.html", { - "attachment": attachment, - "lines": data.splitlines() if data else None, - }, - RequestContext(request)) + response = HttpResponse(mimetype=attachment.mime_type) + response['Content-Disposition'] = 'attachment; filename=%s' % ( + attachment.content_filename) + response.write(data) + return response @BreadCrumb("Reports", parent=index) @@ -808,7 +813,7 @@ except TestingEffort.DoesNotExist: raise Http404() if not effort.project.is_owned_by(request.user): - return HttpReseponse("not allowed") + return HttpResponse("not allowed") if request.method == 'POST': form = TestingEffortForm(request.POST) # Check the form