prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Errors occur when update a page
  ### What I'm trying to achieve
  Update a `Page`
  
  ### Steps to reproduce the problem
  1.  Call `Mutation.pageUpdate ` with `input: {}`
  ```bash
  web_1     | ERROR saleor.graphql.errors.unhandled A query failed unexpectedly [PID:8:Thread-52]
  web_1     | Traceback (most recent call last):
  web_1     |   File "/usr/local/lib/python3.8/site-packages/promise/promise.py", line 489, in _resolve_from_executor
  web_1     |     executor(resolve, reject)
  web_1     |   File "/usr/local/lib/python3.8/site-packages/promise/promise.py", line 756, in executor
  web_1     |     return resolve(f(*args, **kwargs))
  web_1     |   File "/usr/local/lib/python3.8/site-packages/graphql/execution/middleware.py", line 75, in make_it_promise
  web_1     |     return next(*args, **kwargs)
  web_1     |   File "/app/saleor/graphql/core/mutations.py", line 279, in mutate
  web_1     |     response = cls.perform_mutation(root, info, **data)
  web_1     |   File "/app/saleor/graphql/core/mutations.py", line 448, in perform_mutation
  web_1     |     cleaned_input = cls.clean_input(info, instance, data)
  web_1     |   File "/app/saleor/graphql/page/mutations.py", line 43, in clean_input
  web_1     |     cleaned_input["slug"] = slugify(cleaned_input["title"])
  web_1     | KeyError: 'title'
  ```
  
  ### What I expected to happen
  should update a `Page` without error
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `saleor/graphql/page/mutations.py`
  Content:
  ```
  1 import graphene
  2 from django.utils.text import slugify
  3 
  4 from ...core.permissions import PagePermissions
  5 from ...page import models
  6 from ..core.mutations import ModelDeleteMutation, ModelMutation
  7 from ..core.types.common import SeoInput
  8 from ..core.utils import clean_seo_fields
  9 
  10 
  11 class PageInput(graphene.InputObjectType):
  12     slug = graphene.String(description="Page internal name.")
  13     title = graphene.String(description="Page title.")
  14     content = graphene.String(
  15         description=("Page content. May consist of ordinary text, HTML and images.")
  16     )
  17     content_json = graphene.JSONString(description="Page content in JSON format.")
  18     is_published = graphene.Boolean(
  19         description="Determines if page is visible in the storefront."
  20     )
  21     publication_date = graphene.String(
  22         description="Publication date. ISO 8601 standard."
  23     )
  24     seo = SeoInput(description="Search engine optimization fields.")
  25 
  26 
  27 class PageCreate(ModelMutation):
  28     class Arguments:
  29         input = PageInput(
  30             required=True, description="Fields required to create a page."
  31         )
  32 
  33     class Meta:
  34         description = "Creates a new page."
  35         model = models.Page
  36         permissions = (PagePermissions.MANAGE_PAGES,)
  37 
  38     @classmethod
  39     def clean_input(cls, info, instance, data):
  40         cleaned_input = super().clean_input(info, instance, data)
  41         slug = cleaned_input.get("slug", "")
  42         if not slug:
  43             cleaned_input["slug"] = slugify(cleaned_input["title"])
  44         clean_seo_fields(cleaned_input)
  45         return cleaned_input
  46 
  47 
  48 class PageUpdate(PageCreate):
  49     class Arguments:
  50         id = graphene.ID(required=True, description="ID of a page to update.")
  51         input = PageInput(
  52             required=True, description="Fields required to update a page."
  53         )
  54 
  55     class Meta:
  56         description = "Updates an existing page."
  57         model = models.Page
  58 
  59 
  60 class PageDelete(ModelDeleteMutation):
  61     class Arguments:
  62         id = graphene.ID(required=True, description="ID of a page to delete.")
  63 
  64     class Meta:
  65         description = "Deletes a page."
  66         model = models.Page
  67         permissions = (PagePermissions.MANAGE_PAGES,)
  68
  ```
  --- 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/saleor/graphql/page/mutations.py b/saleor/graphql/page/mutations.py
  --- a/saleor/graphql/page/mutations.py
  +++ b/saleor/graphql/page/mutations.py
  @@ -39,8 +39,9 @@
       def clean_input(cls, info, instance, data):
           cleaned_input = super().clean_input(info, instance, data)
           slug = cleaned_input.get("slug", "")
  -        if not slug:
  -            cleaned_input["slug"] = slugify(cleaned_input["title"])
  +        title = cleaned_input.get("title", "")
  +        if title and not slug:
  +            cleaned_input["slug"] = slugify(title)
           clean_seo_fields(cleaned_input)
           return cleaned_input
  
verification_info: {"golden_diff": "diff --git a/saleor/graphql/page/mutations.py b/saleor/graphql/page/mutations.py\n--- a/saleor/graphql/page/mutations.py\n+++ b/saleor/graphql/page/mutations.py\n@@ -39,8 +39,9 @@\n     def clean_input(cls, info, instance, data):\n         cleaned_input = super().clean_input(info, instance, data)\n         slug = cleaned_input.get(\"slug\", \"\")\n-        if not slug:\n-            cleaned_input[\"slug\"] = slugify(cleaned_input[\"title\"])\n+        title = cleaned_input.get(\"title\", \"\")\n+        if title and not slug:\n+            cleaned_input[\"slug\"] = slugify(title)\n         clean_seo_fields(cleaned_input)\n         return cleaned_input\n", "issue": "Errors occur when update a page\n### What I'm trying to achieve\r\nUpdate a `Page`\r\n\r\n### Steps to reproduce the problem\r\n1.  Call `Mutation.pageUpdate ` with `input: {}`\r\n```bash\r\nweb_1     | ERROR saleor.graphql.errors.unhandled A query failed unexpectedly [PID:8:Thread-52]\r\nweb_1     | Traceback (most recent call last):\r\nweb_1     |   File \"/usr/local/lib/python3.8/site-packages/promise/promise.py\", line 489, in _resolve_from_executor\r\nweb_1     |     executor(resolve, reject)\r\nweb_1     |   File \"/usr/local/lib/python3.8/site-packages/promise/promise.py\", line 756, in executor\r\nweb_1     |     return resolve(f(*args, **kwargs))\r\nweb_1     |   File \"/usr/local/lib/python3.8/site-packages/graphql/execution/middleware.py\", line 75, in make_it_promise\r\nweb_1     |     return next(*args, **kwargs)\r\nweb_1     |   File \"/app/saleor/graphql/core/mutations.py\", line 279, in mutate\r\nweb_1     |     response = cls.perform_mutation(root, info, **data)\r\nweb_1     |   File \"/app/saleor/graphql/core/mutations.py\", line 448, in perform_mutation\r\nweb_1     |     cleaned_input = cls.clean_input(info, instance, data)\r\nweb_1     |   File \"/app/saleor/graphql/page/mutations.py\", line 43, in clean_input\r\nweb_1     |     cleaned_input[\"slug\"] = slugify(cleaned_input[\"title\"])\r\nweb_1     | KeyError: 'title'\r\n```\r\n\r\n### What I expected to happen\r\nshould update a `Page` without error\r\n\r\n\n", "before_files": [{"content": "import graphene\nfrom django.utils.text import slugify\n\nfrom ...core.permissions import PagePermissions\nfrom ...page import models\nfrom ..core.mutations import ModelDeleteMutation, ModelMutation\nfrom ..core.types.common import SeoInput\nfrom ..core.utils import clean_seo_fields\n\n\nclass PageInput(graphene.InputObjectType):\n    slug = graphene.String(description=\"Page internal name.\")\n    title = graphene.String(description=\"Page title.\")\n    content = graphene.String(\n        description=(\"Page content. May consist of ordinary text, HTML and images.\")\n    )\n    content_json = graphene.JSONString(description=\"Page content in JSON format.\")\n    is_published = graphene.Boolean(\n        description=\"Determines if page is visible in the storefront.\"\n    )\n    publication_date = graphene.String(\n        description=\"Publication date. ISO 8601 standard.\"\n    )\n    seo = SeoInput(description=\"Search engine optimization fields.\")\n\n\nclass PageCreate(ModelMutation):\n    class Arguments:\n        input = PageInput(\n            required=True, description=\"Fields required to create a page.\"\n        )\n\n    class Meta:\n        description = \"Creates a new page.\"\n        model = models.Page\n        permissions = (PagePermissions.MANAGE_PAGES,)\n\n    @classmethod\n    def clean_input(cls, info, instance, data):\n        cleaned_input = super().clean_input(info, instance, data)\n        slug = cleaned_input.get(\"slug\", \"\")\n        if not slug:\n            cleaned_input[\"slug\"] = slugify(cleaned_input[\"title\"])\n        clean_seo_fields(cleaned_input)\n        return cleaned_input\n\n\nclass PageUpdate(PageCreate):\n    class Arguments:\n        id = graphene.ID(required=True, description=\"ID of a page to update.\")\n        input = PageInput(\n            required=True, description=\"Fields required to update a page.\"\n        )\n\n    class Meta:\n        description = \"Updates an existing page.\"\n        model = models.Page\n\n\nclass PageDelete(ModelDeleteMutation):\n    class Arguments:\n        id = graphene.ID(required=True, description=\"ID of a page to delete.\")\n\n    class Meta:\n        description = \"Deletes a page.\"\n        model = models.Page\n        permissions = (PagePermissions.MANAGE_PAGES,)\n", "path": "saleor/graphql/page/mutations.py"}], "after_files": [{"content": "import graphene\nfrom django.utils.text import slugify\n\nfrom ...core.permissions import PagePermissions\nfrom ...page import models\nfrom ..core.mutations import ModelDeleteMutation, ModelMutation\nfrom ..core.types.common import SeoInput\nfrom ..core.utils import clean_seo_fields\n\n\nclass PageInput(graphene.InputObjectType):\n    slug = graphene.String(description=\"Page internal name.\")\n    title = graphene.String(description=\"Page title.\")\n    content = graphene.String(\n        description=(\"Page content. May consist of ordinary text, HTML and images.\")\n    )\n    content_json = graphene.JSONString(description=\"Page content in JSON format.\")\n    is_published = graphene.Boolean(\n        description=\"Determines if page is visible in the storefront.\"\n    )\n    publication_date = graphene.String(\n        description=\"Publication date. ISO 8601 standard.\"\n    )\n    seo = SeoInput(description=\"Search engine optimization fields.\")\n\n\nclass PageCreate(ModelMutation):\n    class Arguments:\n        input = PageInput(\n            required=True, description=\"Fields required to create a page.\"\n        )\n\n    class Meta:\n        description = \"Creates a new page.\"\n        model = models.Page\n        permissions = (PagePermissions.MANAGE_PAGES,)\n\n    @classmethod\n    def clean_input(cls, info, instance, data):\n        cleaned_input = super().clean_input(info, instance, data)\n        slug = cleaned_input.get(\"slug\", \"\")\n        title = cleaned_input.get(\"title\", \"\")\n        if title and not slug:\n            cleaned_input[\"slug\"] = slugify(title)\n        clean_seo_fields(cleaned_input)\n        return cleaned_input\n\n\nclass PageUpdate(PageCreate):\n    class Arguments:\n        id = graphene.ID(required=True, description=\"ID of a page to update.\")\n        input = PageInput(\n            required=True, description=\"Fields required to update a page.\"\n        )\n\n    class Meta:\n        description = \"Updates an existing page.\"\n        model = models.Page\n\n\nclass PageDelete(ModelDeleteMutation):\n    class Arguments:\n        id = graphene.ID(required=True, description=\"ID of a page to delete.\")\n\n    class Meta:\n        description = \"Deletes a page.\"\n        model = models.Page\n        permissions = (PagePermissions.MANAGE_PAGES,)\n", "path": "saleor/graphql/page/mutations.py"}]}