prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Add canonicals to category page
  For example this two pages contains no canonicals:
  - https://www.shopelectro.ru/catalog/categories/akkumuliatory-270/tags/li-ro_hbced/?page=2
  - ~https://www.shopelectro.ru/catalog/categories/akkumuliatory-270/?page=2~ checked - it contains canonical
  Add canonicals to category page
  For example this two pages contains no canonicals:
  - https://www.shopelectro.ru/catalog/categories/akkumuliatory-270/tags/li-ro_hbced/?page=2
  - ~https://www.shopelectro.ru/catalog/categories/akkumuliatory-270/?page=2~ checked - it contains canonical
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `shopelectro/context.py`
  Content:
  ```
  1 from functools import partial
  2 
  3 from catalog.newcontext import Context, Tags
  4 
  5 
  6 class Page(Context):
  7 
  8     def __init__(self, page, tags: Tags):
  9         self._page = page
  10         self._tags = tags
  11 
  12     def context(self):
  13         def template_context(page, tag_titles, tags):
  14             return {
  15                 'page': page,
  16                 'tag_titles': tag_titles,
  17                 'tags': tags,
  18             }
  19 
  20         tags_qs = self._tags.qs()
  21         self._page.get_template_render_context = partial(
  22             template_context, self._page, tags_qs.as_title(), tags_qs
  23         )
  24 
  25         return {
  26             'page': self._page,
  27             'skip_canonical': tags_qs.exists(),
  28         }
  29
  ```
  --- 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/shopelectro/context.py b/shopelectro/context.py
  --- a/shopelectro/context.py
  +++ b/shopelectro/context.py
  @@ -24,5 +24,4 @@
   
           return {
               'page': self._page,
  -            'skip_canonical': tags_qs.exists(),
           }
  
verification_info: {"golden_diff": "diff --git a/shopelectro/context.py b/shopelectro/context.py\n--- a/shopelectro/context.py\n+++ b/shopelectro/context.py\n@@ -24,5 +24,4 @@\n \n         return {\n             'page': self._page,\n-            'skip_canonical': tags_qs.exists(),\n         }\n", "issue": "Add canonicals to category page\nFor example this two pages contains no canonicals:\r\n- https://www.shopelectro.ru/catalog/categories/akkumuliatory-270/tags/li-ro_hbced/?page=2\r\n- ~https://www.shopelectro.ru/catalog/categories/akkumuliatory-270/?page=2~ checked - it contains canonical\nAdd canonicals to category page\nFor example this two pages contains no canonicals:\r\n- https://www.shopelectro.ru/catalog/categories/akkumuliatory-270/tags/li-ro_hbced/?page=2\r\n- ~https://www.shopelectro.ru/catalog/categories/akkumuliatory-270/?page=2~ checked - it contains canonical\n", "before_files": [{"content": "from functools import partial\n\nfrom catalog.newcontext import Context, Tags\n\n\nclass Page(Context):\n\n    def __init__(self, page, tags: Tags):\n        self._page = page\n        self._tags = tags\n\n    def context(self):\n        def template_context(page, tag_titles, tags):\n            return {\n                'page': page,\n                'tag_titles': tag_titles,\n                'tags': tags,\n            }\n\n        tags_qs = self._tags.qs()\n        self._page.get_template_render_context = partial(\n            template_context, self._page, tags_qs.as_title(), tags_qs\n        )\n\n        return {\n            'page': self._page,\n            'skip_canonical': tags_qs.exists(),\n        }\n", "path": "shopelectro/context.py"}], "after_files": [{"content": "from functools import partial\n\nfrom catalog.newcontext import Context, Tags\n\n\nclass Page(Context):\n\n    def __init__(self, page, tags: Tags):\n        self._page = page\n        self._tags = tags\n\n    def context(self):\n        def template_context(page, tag_titles, tags):\n            return {\n                'page': page,\n                'tag_titles': tag_titles,\n                'tags': tags,\n            }\n\n        tags_qs = self._tags.qs()\n        self._page.get_template_render_context = partial(\n            template_context, self._page, tags_qs.as_title(), tags_qs\n        )\n\n        return {\n            'page': self._page,\n        }\n", "path": "shopelectro/context.py"}]}