From patchwork Mon Aug 27 14:34:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-Doyle Hudson X-Patchwork-Id: 10980 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 9C98423E56 for ; Mon, 27 Aug 2012 14:34:14 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id AA92FA18208 for ; Mon, 27 Aug 2012 14:33:47 +0000 (UTC) Received: by iafj25 with SMTP id j25so5686977iaf.11 for ; Mon, 27 Aug 2012 07:34:13 -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=JdNT6wBtttslGnTtTGWM4iJ3WOKKcaRTzZoAt/FYMwc=; b=iS5pBM8478PRZ7ULDfIhHtqmOj3oeKWcY7FGl9qJ7+0TZgSEhw7NQQfk++4O5pdzsq xjaogWzQmxts/jWqEM45iX2ZbCK5pDgxwkRg/WBR3J6Ie3Ug7rKlHC/otxHSFrnW2deC +zXp1yzs/Qx70XmLi5CSr2VPSbBJ1aFEC0WvGSKPyegnB3QMUY3KL9t9tNIAbZ9MYzd/ aatur12kCI0dUhy6plcrQn+o86iDMvlzr36QzemZw3kpGqSqHRbBgx3Eku40lKFDRT3Q jheHeSrbz1Cy+NDed+8T9nUNSdf9RGTnkKiaIPgJCmcALh7P0ieXbs/Nk4nOlbnIDpz3 y9zA== Received: by 10.50.180.129 with SMTP id do1mr10438074igc.28.1346078053541; Mon, 27 Aug 2012 07:34:13 -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.50.184.232 with SMTP id ex8csp444072igc; Mon, 27 Aug 2012 07:34:12 -0700 (PDT) Received: by 10.217.1.197 with SMTP id n47mr6894131wes.27.1346078052056; Mon, 27 Aug 2012 07:34:12 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id e47si25048944wep.3.2012.08.27.07.34.11 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Aug 2012 07:34:12 -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 1T60OJ-0003aD-Bi for ; Mon, 27 Aug 2012 14:34:11 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 48C01E01FD for ; Mon, 27 Aug 2012 14:34:11 +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: 332 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dashboard/trunk] Rev 332: make the bundle page robust against the bundle not existing on disk Message-Id: <20120827143411.7595.84118.launchpad@ackee.canonical.com> Date: Mon, 27 Aug 2012 14:34:11 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="15843"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 45a32532c1e821bd2bb91ca279f53c56716e612e X-Gm-Message-State: ALoCoQnKGARaf3HiwccE86Bd5B6HBx+L5rnm2po081IzHRdnnO4kbq3w+7deaVTLBNlmrPzl9FRO ------------------------------------------------------------ revno: 332 committer: Michael Hudson-Doyle branch nick: missing-bundles-working-page timestamp: Mon 2012-08-27 12:31:59 +1200 message: make the bundle page robust against the bundle not existing on disk modified: dashboard_app/models.py dashboard_app/templates/dashboard_app/bundle_detail.html --- 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/models.py' --- dashboard_app/models.py 2012-08-05 22:25:32 +0000 +++ dashboard_app/models.py 2012-08-27 00:31:59 +0000 @@ -43,6 +43,7 @@ from django.db.models.signals import post_delete from django.dispatch import receiver from django.template import Template, Context +from django.template.defaultfilters import filesizeformat from django.utils.translation import ugettext as _ from django.utils.translation import ungettext @@ -543,16 +544,26 @@ self.content.close() def get_document_format(self): - self.content.open('rb') try: - fmt, doc = DocumentIO.load(self.content) - return fmt - finally: - self.content.close() + self.content.open('rb') + except IOError: + return "unknown" + else: + try: + fmt, doc = DocumentIO.load(self.content) + return fmt + finally: + self.content.close() def get_serialization_format(self): return "JSON" + def get_content_size(self): + try: + return filesizeformat(self.content.size) + except OSError: + return "unknown" + class SanitizedBundle(object): === modified file 'dashboard_app/templates/dashboard_app/bundle_detail.html' --- dashboard_app/templates/dashboard_app/bundle_detail.html 2012-06-25 02:17:16 +0000 +++ dashboard_app/templates/dashboard_app/bundle_detail.html 2012-08-27 00:31:59 +0000 @@ -44,7 +44,7 @@
Content SHA1:
{{ bundle.content_sha1 }}
Content size:
-
{{ bundle.content.size|filesizeformat }}
+
{{ bundle.get_content_size }}

Storage and format