prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Disable 'delete confirm' button until confirmation word is correct
  We currently have a modal on `warehouse/templates/manage/settings.html`, that allows the user to confirm that they want to delete their project:
  
  ![screenshot from 2018-02-03 14-43-29](https://user-images.githubusercontent.com/3323703/35768242-9dcfc21a-08f0-11e8-834d-fdcc3e6cd998.png)
  
  The user is required to enter the project name as an extra security measure.  If they get it wrong, we show them this error:
  
  ![screenshot from 2018-02-03 14-44-19](https://user-images.githubusercontent.com/3323703/35768249-bba976d2-08f0-11e8-97ba-99c37bfc7479.png)
  
  ## Proposal
  
  It would be really nice if we could `disable` the delete button until the correct project name is given, e.g.
  
  ![screenshot from 2018-02-03 14-46-02](https://user-images.githubusercontent.com/3323703/35768271-fa2cdc64-08f0-11e8-848f-58433e60ae6b.png)
  
  ![screenshot from 2018-02-03 14-46-25](https://user-images.githubusercontent.com/3323703/35768274-0692bca8-08f1-11e8-9149-3aa7a5faad65.png)
  
  ## Notes
  
  We will have several other delete confirmation modals on other pages, sometimes with multiple modals on a single page (e.g. delete release, delete file) - so the code will need to be written to take this into account.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `warehouse/utils/project.py`
  Content:
  ```
  1 # Licensed under the Apache License, Version 2.0 (the "License");
  2 # you may not use this file except in compliance with the License.
  3 # You may obtain a copy of the License at
  4 #
  5 # http://www.apache.org/licenses/LICENSE-2.0
  6 #
  7 # Unless required by applicable law or agreed to in writing, software
  8 # distributed under the License is distributed on an "AS IS" BASIS,
  9 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10 # See the License for the specific language governing permissions and
  11 # limitations under the License.
  12 
  13 from packaging.utils import canonicalize_name
  14 from pyramid.httpexceptions import HTTPSeeOther
  15 
  16 from warehouse.packaging.models import (
  17     Release, Dependency, File, Role, JournalEntry, release_classifiers
  18 )
  19 
  20 
  21 def confirm_project(project, request, fail_route):
  22     confirm = request.POST.get("confirm")
  23     project_name = project.normalized_name
  24     if not confirm:
  25         request.session.flash(
  26             "Must confirm the request.",
  27             queue="error",
  28         )
  29         raise HTTPSeeOther(
  30             request.route_path(fail_route, project_name=project_name)
  31         )
  32     if canonicalize_name(confirm) != project.normalized_name:
  33         request.session.flash(
  34             "Could not delete project - " +
  35             f"{confirm!r} is not the same as {project.normalized_name!r}",
  36             queue="error",
  37         )
  38         raise HTTPSeeOther(
  39             request.route_path(fail_route, project_name=project_name)
  40         )
  41 
  42 
  43 def remove_project(project, request, flash=True):
  44     # TODO: We don't actually delete files from the data store. We should add
  45     #       some kind of garbage collection at some point.
  46 
  47     request.db.add(
  48         JournalEntry(
  49             name=project.name,
  50             action="remove",
  51             submitted_by=request.user,
  52             submitted_from=request.remote_addr,
  53         )
  54     )
  55     request.db.query(Role).filter(Role.project == project).delete()
  56     request.db.query(File).filter(File.name == project.name).delete()
  57     (request.db.query(Dependency).filter(Dependency.name == project.name)
  58                .delete())
  59     (request.db.execute(release_classifiers.delete()
  60                         .where(release_classifiers.c.name ==
  61                                project.name)))
  62 
  63     # Load the following objects into the session and individually delete them
  64     # so they are included in `session.deleted` and their cache keys are purged
  65 
  66     # Delete releases first, otherwise they will get cascade-deleted by the
  67     # project deletion and won't be purged
  68     for release in (
  69             request.db.query(Release)
  70             .filter(Release.project == project)
  71             .all()):
  72         request.db.delete(release)
  73 
  74     # Finally, delete the project
  75     request.db.delete(project)
  76 
  77     # Flush so we can repeat this multiple times if necessary
  78     request.db.flush()
  79 
  80     if flash:
  81         request.session.flash(
  82             f"Successfully deleted the project {project.name!r}.",
  83             queue="success",
  84         )
  85
  ```
  --- 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/warehouse/utils/project.py b/warehouse/utils/project.py
  --- a/warehouse/utils/project.py
  +++ b/warehouse/utils/project.py
  @@ -19,7 +19,7 @@
   
   
   def confirm_project(project, request, fail_route):
  -    confirm = request.POST.get("confirm")
  +    confirm = request.POST.get("confirm_project_name")
       project_name = project.normalized_name
       if not confirm:
           request.session.flash(
  
verification_info: {"golden_diff": "diff --git a/warehouse/utils/project.py b/warehouse/utils/project.py\n--- a/warehouse/utils/project.py\n+++ b/warehouse/utils/project.py\n@@ -19,7 +19,7 @@\n \n \n def confirm_project(project, request, fail_route):\n-    confirm = request.POST.get(\"confirm\")\n+    confirm = request.POST.get(\"confirm_project_name\")\n     project_name = project.normalized_name\n     if not confirm:\n         request.session.flash(\n", "issue": "Disable 'delete confirm' button until confirmation word is correct\nWe currently have a modal on `warehouse/templates/manage/settings.html`, that allows the user to confirm that they want to delete their project:\r\n\r\n![screenshot from 2018-02-03 14-43-29](https://user-images.githubusercontent.com/3323703/35768242-9dcfc21a-08f0-11e8-834d-fdcc3e6cd998.png)\r\n\r\nThe user is required to enter the project name as an extra security measure.  If they get it wrong, we show them this error:\r\n\r\n![screenshot from 2018-02-03 14-44-19](https://user-images.githubusercontent.com/3323703/35768249-bba976d2-08f0-11e8-97ba-99c37bfc7479.png)\r\n\r\n## Proposal\r\n\r\nIt would be really nice if we could `disable` the delete button until the correct project name is given, e.g.\r\n\r\n![screenshot from 2018-02-03 14-46-02](https://user-images.githubusercontent.com/3323703/35768271-fa2cdc64-08f0-11e8-848f-58433e60ae6b.png)\r\n\r\n![screenshot from 2018-02-03 14-46-25](https://user-images.githubusercontent.com/3323703/35768274-0692bca8-08f1-11e8-9149-3aa7a5faad65.png)\r\n\r\n## Notes\r\n\r\nWe will have several other delete confirmation modals on other pages, sometimes with multiple modals on a single page (e.g. delete release, delete file) - so the code will need to be written to take this into account.\r\n\n", "before_files": [{"content": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom packaging.utils import canonicalize_name\nfrom pyramid.httpexceptions import HTTPSeeOther\n\nfrom warehouse.packaging.models import (\n    Release, Dependency, File, Role, JournalEntry, release_classifiers\n)\n\n\ndef confirm_project(project, request, fail_route):\n    confirm = request.POST.get(\"confirm\")\n    project_name = project.normalized_name\n    if not confirm:\n        request.session.flash(\n            \"Must confirm the request.\",\n            queue=\"error\",\n        )\n        raise HTTPSeeOther(\n            request.route_path(fail_route, project_name=project_name)\n        )\n    if canonicalize_name(confirm) != project.normalized_name:\n        request.session.flash(\n            \"Could not delete project - \" +\n            f\"{confirm!r} is not the same as {project.normalized_name!r}\",\n            queue=\"error\",\n        )\n        raise HTTPSeeOther(\n            request.route_path(fail_route, project_name=project_name)\n        )\n\n\ndef remove_project(project, request, flash=True):\n    # TODO: We don't actually delete files from the data store. We should add\n    #       some kind of garbage collection at some point.\n\n    request.db.add(\n        JournalEntry(\n            name=project.name,\n            action=\"remove\",\n            submitted_by=request.user,\n            submitted_from=request.remote_addr,\n        )\n    )\n    request.db.query(Role).filter(Role.project == project).delete()\n    request.db.query(File).filter(File.name == project.name).delete()\n    (request.db.query(Dependency).filter(Dependency.name == project.name)\n               .delete())\n    (request.db.execute(release_classifiers.delete()\n                        .where(release_classifiers.c.name ==\n                               project.name)))\n\n    # Load the following objects into the session and individually delete them\n    # so they are included in `session.deleted` and their cache keys are purged\n\n    # Delete releases first, otherwise they will get cascade-deleted by the\n    # project deletion and won't be purged\n    for release in (\n            request.db.query(Release)\n            .filter(Release.project == project)\n            .all()):\n        request.db.delete(release)\n\n    # Finally, delete the project\n    request.db.delete(project)\n\n    # Flush so we can repeat this multiple times if necessary\n    request.db.flush()\n\n    if flash:\n        request.session.flash(\n            f\"Successfully deleted the project {project.name!r}.\",\n            queue=\"success\",\n        )\n", "path": "warehouse/utils/project.py"}], "after_files": [{"content": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom packaging.utils import canonicalize_name\nfrom pyramid.httpexceptions import HTTPSeeOther\n\nfrom warehouse.packaging.models import (\n    Release, Dependency, File, Role, JournalEntry, release_classifiers\n)\n\n\ndef confirm_project(project, request, fail_route):\n    confirm = request.POST.get(\"confirm_project_name\")\n    project_name = project.normalized_name\n    if not confirm:\n        request.session.flash(\n            \"Must confirm the request.\",\n            queue=\"error\",\n        )\n        raise HTTPSeeOther(\n            request.route_path(fail_route, project_name=project_name)\n        )\n    if canonicalize_name(confirm) != project.normalized_name:\n        request.session.flash(\n            \"Could not delete project - \" +\n            f\"{confirm!r} is not the same as {project.normalized_name!r}\",\n            queue=\"error\",\n        )\n        raise HTTPSeeOther(\n            request.route_path(fail_route, project_name=project_name)\n        )\n\n\ndef remove_project(project, request, flash=True):\n    # TODO: We don't actually delete files from the data store. We should add\n    #       some kind of garbage collection at some point.\n\n    request.db.add(\n        JournalEntry(\n            name=project.name,\n            action=\"remove\",\n            submitted_by=request.user,\n            submitted_from=request.remote_addr,\n        )\n    )\n    request.db.query(Role).filter(Role.project == project).delete()\n    request.db.query(File).filter(File.name == project.name).delete()\n    (request.db.query(Dependency).filter(Dependency.name == project.name)\n               .delete())\n    (request.db.execute(release_classifiers.delete()\n                        .where(release_classifiers.c.name ==\n                               project.name)))\n\n    # Load the following objects into the session and individually delete them\n    # so they are included in `session.deleted` and their cache keys are purged\n\n    # Delete releases first, otherwise they will get cascade-deleted by the\n    # project deletion and won't be purged\n    for release in (\n            request.db.query(Release)\n            .filter(Release.project == project)\n            .all()):\n        request.db.delete(release)\n\n    # Finally, delete the project\n    request.db.delete(project)\n\n    # Flush so we can repeat this multiple times if necessary\n    request.db.flush()\n\n    if flash:\n        request.session.flash(\n            f\"Successfully deleted the project {project.name!r}.\",\n            queue=\"success\",\n        )\n", "path": "warehouse/utils/project.py"}]}