From patchwork Wed Aug 7 08:40:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Terceiro X-Patchwork-Id: 18823 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 81AC8246A4 for ; Wed, 7 Aug 2013 08:40:46 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id m1sf1712789ves.6 for ; Wed, 07 Aug 2013 01:40:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:delivered-to:mime-version:to:from:subject :message-id:date:reply-to:sender:errors-to:precedence :x-original-sender:x-original-authentication-results:mailing-list :list-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=M3fynaaDPeobyd8KnjxAujq4adlqPt2vPZmcJ8TXzEo=; b=dpt+J9A/IYgnB8I4ShRbI0kIs89XD8u4s7stiNSN67PossJq7BIzqAhFJHdal8po3A TcCKeZKiRa1I8Y353GNGUg/qs4t9Hj/59Pp8RO799NxfCLU/ZpEm0Pu8TEZfp++KPdND /kBWHPSyXTYVRLjsEBFUKVZX1MGnJfy264Dhzqc/yPBo6lt561WvXukPaGprqjOhu75o pB4RMtX3431rBKQicww7Td0HltL9J4yCsSIMgj05kKoPmFrdkd5q2dOJ4aabaL6qIBge AZNKryJOCAaIREDX/An7sALlcfLm7UQD+IO705sFA9PMMetDQCOelCQWkSa/8X+H4fA1 3kbQ== X-Received: by 10.236.15.73 with SMTP id e49mr1044016yhe.15.1375864845983; Wed, 07 Aug 2013 01:40:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.129.233 with SMTP id nz9ls562768qeb.33.gmail; Wed, 07 Aug 2013 01:40:45 -0700 (PDT) X-Received: by 10.52.73.135 with SMTP id l7mr609167vdv.9.1375864845752; Wed, 07 Aug 2013 01:40:45 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id y4si1313686vcy.30.2013.08.07.01.40.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 07 Aug 2013 01:40:45 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id pb11so1477089veb.11 for ; Wed, 07 Aug 2013 01:40:45 -0700 (PDT) X-Gm-Message-State: ALoCoQl5xXDcaX6Q64CJgEG95JpY4qZuPHCo7PnHT2N6UuLKTWTI8c9BSvZdWygA55a++HWGlIGx X-Received: by 10.221.47.193 with SMTP id ut1mr682471vcb.8.1375864845552; Wed, 07 Aug 2013 01:40:45 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.11.8 with SMTP id pc8csp189187vcb; Wed, 7 Aug 2013 01:40:44 -0700 (PDT) X-Received: by 10.194.238.199 with SMTP id vm7mr1483112wjc.37.1375864844310; Wed, 07 Aug 2013 01:40:44 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id gl2si3027518wib.81.2013.08.07.01.40.43 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 07 Aug 2013 01:40:44 -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; Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1V6zIR-0002Et-R0 for ; Wed, 07 Aug 2013 08:40:43 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id BFDCFE9B04 for ; Wed, 7 Aug 2013 08:40:43 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-scheduler X-Launchpad-Branch: ~linaro-validation/lava-scheduler/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 252 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-scheduler/trunk] Rev 252: [Milosz Wasilewski] show line numbers in log view Message-Id: <20130807084043.29203.18636.launchpad@ackee.canonical.com> Date: Wed, 07 Aug 2013 08:40:43 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: list X-Generated-By: Launchpad (canonical.com); Revision="16721"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 41c3f34b012b9485447bf27e2285308f0f5b6b0e X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: noreply@launchpad.net X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Merge authors: Milosz Wasilewski (mwasilew) Related merge proposals: https://code.launchpad.net/~mwasilew/lava-scheduler/log_linenumbers/+merge/177597 proposed by: Milosz Wasilewski (mwasilew) review: Needs Fixing - Antonio Terceiro (terceiro) ------------------------------------------------------------ revno: 252 [merge] committer: Antonio Terceiro branch nick: trunk timestamp: Wed 2013-08-07 10:38:35 +0200 message: [Milosz Wasilewski] show line numbers in log view added: lava_scheduler_app/templatetags/ lava_scheduler_app/templatetags/__init__.py lava_scheduler_app/templatetags/linenumbers.py modified: lava_scheduler_app/static/lava_scheduler_app/css/logfile.css lava_scheduler_app/templates/lava_scheduler_app/job_log_file.html --- lp:lava-scheduler https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk You are subscribed to branch lp:lava-scheduler. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk/+edit-subscription === modified file 'lava_scheduler_app/static/lava_scheduler_app/css/logfile.css' --- lava_scheduler_app/static/lava_scheduler_app/css/logfile.css 2011-12-13 04:22:40 +0000 +++ lava_scheduler_app/static/lava_scheduler_app/css/logfile.css 2013-07-30 10:15:36 +0000 @@ -24,3 +24,13 @@ border-width: medium; } +.line +{ + line-height: 18px; + white-space: nowrap; +} + +div:target +{ + background-color: rgb(255, 128, 128); +} === modified file 'lava_scheduler_app/templates/lava_scheduler_app/job_log_file.html' --- lava_scheduler_app/templates/lava_scheduler_app/job_log_file.html 2012-03-19 23:44:40 +0000 +++ lava_scheduler_app/templates/lava_scheduler_app/job_log_file.html 2013-07-30 10:15:36 +0000 @@ -6,6 +6,7 @@ {% endblock %} {% block content %} +{% load linenumbers %}

Dispatcher log file - {{ job.id }}

Download as text file @@ -15,7 +16,7 @@ {% if section.0 == 'console' and section.1 > 20 and not forloop.last %} skip {{ section.1 }} lines to next log entry → {% endif %} -
{{ section.2 }}
+{% linenumbers section.2 forloop.counter0 section.0 %} {% endfor %} {% if job.status == job.RUNNING %} === added directory 'lava_scheduler_app/templatetags' === added file 'lava_scheduler_app/templatetags/__init__.py' === added file 'lava_scheduler_app/templatetags/linenumbers.py' --- lava_scheduler_app/templatetags/linenumbers.py 1970-01-01 00:00:00 +0000 +++ lava_scheduler_app/templatetags/linenumbers.py 2013-07-30 10:15:36 +0000 @@ -0,0 +1,45 @@ +from django import template +from django.db.models import fields +from django.utils.html import escape +from django.utils.safestring import mark_safe + +register = template.Library() + +class LineNumbers(template.Node): + def __init__(self, text, prefix, style): + self.text = template.Variable(text) + self.prefix = template.Variable(prefix) + self.style = template.Variable(style) + + def render(self, context): + text = self.text.resolve(context) + prefix = self.prefix.resolve(context) + style = self.style.resolve(context) + ret = "
" + for i in range(0, len(text.splitlines())): + name = "L_%s_%s" % (prefix, i) + display = "Section %s.%s" % (prefix, i) + ret += "
\ + %s
" % (name, name, display) + + ret += "
\ +
" % (style)
+
+        for index, line in enumerate(text.splitlines()):
+            ret += "
 %s
" % \ + (prefix, + index, + mark_safe(escape(line).encode('ascii', 'xmlcharrefreplace'))) + + ret += "
" + + return ret + +@register.tag('linenumbers') +def do_linenumbers(parser, token): + try: + tag_name, text, prefix, style = token.split_contents() + except ValueError: + raise template.TemplateSyntaxError("%r tag requires 3 arguments" % \ + token.contents.split()[0]) + return LineNumbers(text, prefix, style)