Fix search=None issue

svn: r19816
This commit is contained in:
Doug Blank 2012-06-10 03:29:12 +00:00
parent 120c6b00b9
commit e4faea4cf3
2 changed files with 7 additions and 7 deletions

View File

@ -103,10 +103,10 @@ def context_processor(request):
context["sitename"] = Config.objects.get(setting="sitename").value context["sitename"] = Config.objects.get(setting="sitename").value
context["default"] = "" context["default"] = ""
search = request.GET.get("search", None) or request.POST.get("search", None) search = request.GET.get("search", "") or request.POST.get("search", "")
page = request.GET.get("page", None) or request.POST.get("page", None) page = request.GET.get("page", "") or request.POST.get("page", "")
context["page"] = page context["page"] = page
context["search"] = search context["search"] = search
context["args"] = build_args(search=search, page=page) context["args"] = build_args(search=search, page=page)
return context return context

View File

@ -232,7 +232,7 @@ def build_args(**kwargs):
retval = "" retval = ""
first = True first = True
for key in kwargs: for key in kwargs:
if kwargs[key] is not None: if kwargs[key] is not "":
if first: if first:
retval+= "?" retval+= "?"
first = False first = False
@ -242,8 +242,8 @@ def build_args(**kwargs):
return retval return retval
def build_search(request): def build_search(request):
search = request.GET.get("search", None) or request.POST.get("search", None) search = request.GET.get("search", "") or request.POST.get("search", "")
page = request.GET.get("page", None) or request.POST.get("page", None) page = request.GET.get("page", "") or request.POST.get("page", "")
return build_args(search=search, page=page) return build_args(search=search, page=page)
def make_button(text, url, *args): def make_button(text, url, *args):