Fixed bug with extra getvars where an ampersand was always appended.
authorfloguy <floguy@7f1efe38-554e-0410-b69d-834cb44da2d5>
Fri, 11 Jul 2008 08:09:51 +0000 (08:09 +0000)
committerfloguy <floguy@7f1efe38-554e-0410-b69d-834cb44da2d5>
Fri, 11 Jul 2008 08:09:51 +0000 (08:09 +0000)
git-svn-id: https://django-pagination.googlecode.com/svn/trunk@16 7f1efe38-554e-0410-b69d-834cb44da2d5

pagination/templatetags/pagination_tags.py

index 8a88815..66d8640 100644 (file)
@@ -175,7 +175,10 @@ def paginate(context, window=DEFAULT_WINDOW):
             getvars = context['request'].GET.copy()
             if 'page' in getvars:
                 del getvars['page']
-            to_return['getvars'] = "&%s" % getvars.urlencode()
+            if len(getvars.keys()) > 0:
+                to_return['getvars'] = "&%s" % getvars.urlencode()
+            else:
+                to_return['getvars'] = ''
         return to_return
     except KeyError:
         return {}