From patchwork Fri Aug 17 05:53: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: 10782 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 B88D323E00 for ; Fri, 17 Aug 2012 05:53:15 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 6B65DA18E74 for ; Fri, 17 Aug 2012 05:53:15 +0000 (UTC) Received: by ggmi2 with SMTP id i2so3894022ggm.11 for ; Thu, 16 Aug 2012 22:53:15 -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=a4X97YW/YT4ygTHEEGcVWLzs0MSmxuixQbUxb2kLaAQ=; b=NiWvKsRFGivvOOe6lqbg4EMRBwRKS8N/ouHKMFb+pTcIS2m6Z+qKOlpvwLdC8I4V9u eC1duUtJr+FhOUeQRUzhR4Vo1mTRGA2Ei/oIoV7vRU87f8z0CammSivAGdu7dmHQcNKX x8SGq3p7hTHrCEEye9n6LyIaPDpHjibi7kJR46xg7Fxb/mzFPMyuEZPIQelK8CGuWK91 GS3wM0LxMyTBpV6U7uQgIIbWI1Yg0zSvbqilf1qqFHvHlklyCZcRKjTUQ3+uyD4wVn9g SszmW911PzZ9EiZrtS56snYI6/WTZ1O18vtmBKn2NSU+mqCzg0+tq3QliF8MtkXXmAYt g8wg== Received: by 10.50.154.132 with SMTP id vo4mr662704igb.31.1345182794714; Thu, 16 Aug 2012 22:53:14 -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.200 with SMTP id ew8csp171974igc; Thu, 16 Aug 2012 22:53:13 -0700 (PDT) Received: by 10.180.86.106 with SMTP id o10mr2033773wiz.22.1345182792536; Thu, 16 Aug 2012 22:53:12 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id p10si10213612wic.44.2012.08.16.22.53.11 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 16 Aug 2012 22:53: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 1T2FUd-0006k7-3t for ; Fri, 17 Aug 2012 05:53:11 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 11A0DE004C for ; Fri, 17 Aug 2012 05:53:11 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-server X-Launchpad-Branch: ~linaro-validation/lava-server/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 386 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-server/trunk] Rev 386: obscure sorting fix for when columns are added or removed dynamically Message-Id: <20120817055311.8459.63823.launchpad@ackee.canonical.com> Date: Fri, 17 Aug 2012 05:53: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="15810"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 1bdb996b78db3f0f02b0327e1a1513c515287791 X-Gm-Message-State: ALoCoQlHXvf5L6/Z9x8t4OcX0JZ+HXNdft+kt+qm5X1h/Yq65qOYkAEF4355U8RBESDAeEhnVy0Z ------------------------------------------------------------ revno: 386 committer: Michael Hudson-Doyle branch nick: trunk timestamp: Fri 2012-08-17 17:52:39 +1200 message: obscure sorting fix for when columns are added or removed dynamically modified: lava/utils/data_tables/backends.py --- lp:lava-server https://code.launchpad.net/~linaro-validation/lava-server/trunk You are subscribed to branch lp:lava-server. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-server/trunk/+edit-subscription === modified file 'lava/utils/data_tables/backends.py' --- lava/utils/data_tables/backends.py 2012-03-12 03:55:07 +0000 +++ lava/utils/data_tables/backends.py 2012-08-17 05:52:39 +0000 @@ -234,11 +234,12 @@ return queryset order_by = [] for column_index, order in sorting_columns: - col = self.table.columns[column_index] + name, col = self.table.base_columns.items()[column_index] + accessor = col.accessor or name order_by.append( "{asc_desc}{column}".format( asc_desc="-" if order == 'desc' else '', - column=col.accessor.replace('.', '__'))) + column=accessor.replace('.', '__'))) return queryset.order_by(*order_by) def process(self, query):