From 2360e2c4bcb0fc873a60599165e7f24f20465786 Mon Sep 17 00:00:00 2001
From: Dan McGee <dan@archlinux.org>
Date: Tue, 15 Mar 2011 11:06:34 -0500
Subject: Only set limit if we have one, else default to 50

This was the cause of some pretty awesome performance headaches this
morning.

Signed-off-by: Dan McGee <dan@archlinux.org>
---
 packages/views.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'packages')

diff --git a/packages/views.py b/packages/views.py
index 6239f01a..70b3a84b 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -207,7 +207,9 @@ def search(request, page=None):
                 lu = form.cleaned_data['last_update']
                 packages = packages.filter(last_update__gte=
                         datetime(lu.year, lu.month, lu.day, 0, 0))
-            limit = form.cleaned_data['limit']
+
+            if form.cleaned_data['limit']:
+                limit = form.cleaned_data['limit']
         else:
             # Form had errors, don't return any results, just the busted form
             packages = Package.objects.none()
-- 
cgit v1.2.3-54-g00ecf