prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Impossible de rechercher certainnes informations au delà de la première page
  **Scénario 1:**
  - Aller sur la page de recherche : `http://zestedesavoir.com/rechercher/`
  - Saisir dans la zone de recherche : `&ab`
  - Constatez qu'il y'a des résultats sur plusieurs pages
  - Cliquer sur suivant
  - **Pouf : une erreur 404**
  
  **Scénario 2:**
  - Aller sur la page de recherche : `http://zestedesavoir.com/rechercher/`
  - Saisir dans la zone de recherche : `#1`
  - Constatez qu'il y'a des résultats sur plusieurs pages
  - Cliquer sur suivant
  - **Pouf : le vide s'empare de nous**
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `zds/utils/templatetags/append_to_get.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 
  3 from django import template
  4 from functools import wraps
  5 
  6 register = template.Library()
  7 
  8 """
  9 Decorator to facilitate template tag creation.
  10 """
  11 
  12 
  13 def easy_tag(func):
  14     """
  15     Deal with the repetitive parts of parsing template tags :
  16 
  17      - Wraps functions attributes;
  18      - Raise `TemplateSyntaxError` if arguments are not well formatted.
  19 
  20     :rtype: function
  21     :param func: Function to wraps.
  22     :type func: function
  23     """
  24 
  25     @wraps(func)
  26     def inner(_, token):
  27         split_arg = token.split_contents()
  28         try:
  29             return func(*split_arg)
  30         except TypeError:
  31             import inspect
  32             args = inspect.getargspec(func).args[1:]
  33 
  34             err_msg = 'Bad arguments for tag "{0}".\nThe tag "{0}" take {1} arguments ({2}).\n {3} were provided ({4}).'
  35             fstring = err_msg.format(split_arg[0],
  36                                      len(args),
  37                                      ", ".join(args),
  38                                      len(split_arg),
  39                                      ", ".join(split_arg))
  40             raise template.TemplateSyntaxError(fstring)
  41     return inner
  42 
  43 
  44 class AppendGetNode(template.Node):
  45     """
  46     Template node allowing to render an URL appending argument to current GET address.
  47 
  48     Parse a string like `key1=var1,key2=var2` and generate a new URL with the provided parameters appended to current
  49     parameters.
  50     """
  51 
  52     def __init__(self, arg_list):
  53         """
  54         Create a template node which append `arg_list` to GET URL.
  55 
  56         :param str arg_list: the argument list to append.
  57         """
  58 
  59         self.__dict_pairs = {}
  60         for pair in arg_list.split(','):
  61             if pair:
  62                 try:
  63                     key, val = pair.split('=')
  64                     if not val:
  65                         raise template.TemplateSyntaxError(
  66                             "Bad argument format. Empty value for key '{}".format(key))
  67                     self.__dict_pairs[key] = template.Variable(val)
  68                 except ValueError:
  69                     raise template.TemplateSyntaxError(
  70                         "Bad argument format.\n'{}' must use the format 'key1=var1,key2=var2'".format(arg_list))
  71 
  72     def render(self, context):
  73         """
  74         Render the new URL according to the current context.
  75 
  76         :param context: Current context.
  77         :return: New URL with arguments appended.
  78         :rtype: str
  79         """
  80         get = context['request'].GET.copy()
  81         path = context['request'].META['PATH_INFO']
  82 
  83         for key in self.__dict_pairs:
  84             get[key] = self.__dict_pairs[key].resolve(context)
  85 
  86         if len(get) > 0:
  87             list_arg = [u"{0}={1}".format(key, value) for key in get.keys() for value in get.getlist(key)]
  88             path += u"?" + u"&".join(list_arg)
  89 
  90         return path
  91 
  92 
  93 @register.tag()
  94 @easy_tag
  95 def append_to_get(_, arg_list):
  96     """Render an URL appending argument to current GET address.
  97 
  98     :param _: Tag name (not used)
  99     :param arg_list: Argument list like `key1=var1,key2=var2`
  100     :return: Template node.
  101     """
  102     return AppendGetNode(arg_list)
  103
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/zds/utils/templatetags/append_to_get.py b/zds/utils/templatetags/append_to_get.py
  --- a/zds/utils/templatetags/append_to_get.py
  +++ b/zds/utils/templatetags/append_to_get.py
  @@ -1,6 +1,7 @@
   # -*- coding: utf-8 -*-
   
   from django import template
  +from django.utils.http import urlquote
   from functools import wraps
   
   register = template.Library()
  @@ -84,7 +85,7 @@
               get[key] = self.__dict_pairs[key].resolve(context)
   
           if len(get) > 0:
  -            list_arg = [u"{0}={1}".format(key, value) for key in get.keys() for value in get.getlist(key)]
  +            list_arg = [u"{0}={1}".format(key, urlquote(value)) for key in get.keys() for value in get.getlist(key)]
               path += u"?" + u"&".join(list_arg)
   
           return path
  
verification_info: {"golden_diff": "diff --git a/zds/utils/templatetags/append_to_get.py b/zds/utils/templatetags/append_to_get.py\n--- a/zds/utils/templatetags/append_to_get.py\n+++ b/zds/utils/templatetags/append_to_get.py\n@@ -1,6 +1,7 @@\n # -*- coding: utf-8 -*-\n \n from django import template\n+from django.utils.http import urlquote\n from functools import wraps\n \n register = template.Library()\n@@ -84,7 +85,7 @@\n             get[key] = self.__dict_pairs[key].resolve(context)\n \n         if len(get) > 0:\n-            list_arg = [u\"{0}={1}\".format(key, value) for key in get.keys() for value in get.getlist(key)]\n+            list_arg = [u\"{0}={1}\".format(key, urlquote(value)) for key in get.keys() for value in get.getlist(key)]\n             path += u\"?\" + u\"&\".join(list_arg)\n \n         return path\n", "issue": "Impossible de rechercher certainnes informations au del\u00e0 de la premi\u00e8re page\n**Sc\u00e9nario 1:**\n- Aller sur la page de recherche : `http://zestedesavoir.com/rechercher/`\n- Saisir dans la zone de recherche : `&ab`\n- Constatez qu'il y'a des r\u00e9sultats sur plusieurs pages\n- Cliquer sur suivant\n- **Pouf : une erreur 404**\n\n**Sc\u00e9nario 2:**\n- Aller sur la page de recherche : `http://zestedesavoir.com/rechercher/`\n- Saisir dans la zone de recherche : `#1`\n- Constatez qu'il y'a des r\u00e9sultats sur plusieurs pages\n- Cliquer sur suivant\n- **Pouf : le vide s'empare de nous**\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\nfrom django import template\nfrom functools import wraps\n\nregister = template.Library()\n\n\"\"\"\nDecorator to facilitate template tag creation.\n\"\"\"\n\n\ndef easy_tag(func):\n    \"\"\"\n    Deal with the repetitive parts of parsing template tags :\n\n     - Wraps functions attributes;\n     - Raise `TemplateSyntaxError` if arguments are not well formatted.\n\n    :rtype: function\n    :param func: Function to wraps.\n    :type func: function\n    \"\"\"\n\n    @wraps(func)\n    def inner(_, token):\n        split_arg = token.split_contents()\n        try:\n            return func(*split_arg)\n        except TypeError:\n            import inspect\n            args = inspect.getargspec(func).args[1:]\n\n            err_msg = 'Bad arguments for tag \"{0}\".\\nThe tag \"{0}\" take {1} arguments ({2}).\\n {3} were provided ({4}).'\n            fstring = err_msg.format(split_arg[0],\n                                     len(args),\n                                     \", \".join(args),\n                                     len(split_arg),\n                                     \", \".join(split_arg))\n            raise template.TemplateSyntaxError(fstring)\n    return inner\n\n\nclass AppendGetNode(template.Node):\n    \"\"\"\n    Template node allowing to render an URL appending argument to current GET address.\n\n    Parse a string like `key1=var1,key2=var2` and generate a new URL with the provided parameters appended to current\n    parameters.\n    \"\"\"\n\n    def __init__(self, arg_list):\n        \"\"\"\n        Create a template node which append `arg_list` to GET URL.\n\n        :param str arg_list: the argument list to append.\n        \"\"\"\n\n        self.__dict_pairs = {}\n        for pair in arg_list.split(','):\n            if pair:\n                try:\n                    key, val = pair.split('=')\n                    if not val:\n                        raise template.TemplateSyntaxError(\n                            \"Bad argument format. Empty value for key '{}\".format(key))\n                    self.__dict_pairs[key] = template.Variable(val)\n                except ValueError:\n                    raise template.TemplateSyntaxError(\n                        \"Bad argument format.\\n'{}' must use the format 'key1=var1,key2=var2'\".format(arg_list))\n\n    def render(self, context):\n        \"\"\"\n        Render the new URL according to the current context.\n\n        :param context: Current context.\n        :return: New URL with arguments appended.\n        :rtype: str\n        \"\"\"\n        get = context['request'].GET.copy()\n        path = context['request'].META['PATH_INFO']\n\n        for key in self.__dict_pairs:\n            get[key] = self.__dict_pairs[key].resolve(context)\n\n        if len(get) > 0:\n            list_arg = [u\"{0}={1}\".format(key, value) for key in get.keys() for value in get.getlist(key)]\n            path += u\"?\" + u\"&\".join(list_arg)\n\n        return path\n\n\n@register.tag()\n@easy_tag\ndef append_to_get(_, arg_list):\n    \"\"\"Render an URL appending argument to current GET address.\n\n    :param _: Tag name (not used)\n    :param arg_list: Argument list like `key1=var1,key2=var2`\n    :return: Template node.\n    \"\"\"\n    return AppendGetNode(arg_list)\n", "path": "zds/utils/templatetags/append_to_get.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\nfrom django import template\nfrom django.utils.http import urlquote\nfrom functools import wraps\n\nregister = template.Library()\n\n\"\"\"\nDecorator to facilitate template tag creation.\n\"\"\"\n\n\ndef easy_tag(func):\n    \"\"\"\n    Deal with the repetitive parts of parsing template tags :\n\n     - Wraps functions attributes;\n     - Raise `TemplateSyntaxError` if arguments are not well formatted.\n\n    :rtype: function\n    :param func: Function to wraps.\n    :type func: function\n    \"\"\"\n\n    @wraps(func)\n    def inner(_, token):\n        split_arg = token.split_contents()\n        try:\n            return func(*split_arg)\n        except TypeError:\n            import inspect\n            args = inspect.getargspec(func).args[1:]\n\n            err_msg = 'Bad arguments for tag \"{0}\".\\nThe tag \"{0}\" take {1} arguments ({2}).\\n {3} were provided ({4}).'\n            fstring = err_msg.format(split_arg[0],\n                                     len(args),\n                                     \", \".join(args),\n                                     len(split_arg),\n                                     \", \".join(split_arg))\n            raise template.TemplateSyntaxError(fstring)\n    return inner\n\n\nclass AppendGetNode(template.Node):\n    \"\"\"\n    Template node allowing to render an URL appending argument to current GET address.\n\n    Parse a string like `key1=var1,key2=var2` and generate a new URL with the provided parameters appended to current\n    parameters.\n    \"\"\"\n\n    def __init__(self, arg_list):\n        \"\"\"\n        Create a template node which append `arg_list` to GET URL.\n\n        :param str arg_list: the argument list to append.\n        \"\"\"\n\n        self.__dict_pairs = {}\n        for pair in arg_list.split(','):\n            if pair:\n                try:\n                    key, val = pair.split('=')\n                    if not val:\n                        raise template.TemplateSyntaxError(\n                            \"Bad argument format. Empty value for key '{}\".format(key))\n                    self.__dict_pairs[key] = template.Variable(val)\n                except ValueError:\n                    raise template.TemplateSyntaxError(\n                        \"Bad argument format.\\n'{}' must use the format 'key1=var1,key2=var2'\".format(arg_list))\n\n    def render(self, context):\n        \"\"\"\n        Render the new URL according to the current context.\n\n        :param context: Current context.\n        :return: New URL with arguments appended.\n        :rtype: str\n        \"\"\"\n        get = context['request'].GET.copy()\n        path = context['request'].META['PATH_INFO']\n\n        for key in self.__dict_pairs:\n            get[key] = self.__dict_pairs[key].resolve(context)\n\n        if len(get) > 0:\n            list_arg = [u\"{0}={1}\".format(key, urlquote(value)) for key in get.keys() for value in get.getlist(key)]\n            path += u\"?\" + u\"&\".join(list_arg)\n\n        return path\n\n\n@register.tag()\n@easy_tag\ndef append_to_get(_, arg_list):\n    \"\"\"Render an URL appending argument to current GET address.\n\n    :param _: Tag name (not used)\n    :param arg_list: Argument list like `key1=var1,key2=var2`\n    :return: Template node.\n    \"\"\"\n    return AppendGetNode(arg_list)\n", "path": "zds/utils/templatetags/append_to_get.py"}]}