{"action":"created","issue":{"url":"https://api.github.com/repos/encode/django-rest-framework/issues/4704","repository_url":"https://api.github.com/repos/encode/django-rest-framework","labels_url":"https://api.github.com/repos/encode/django-rest-framework/issues/4704/labels{/name}","comments_url":"https://api.github.com/repos/encode/django-rest-framework/issues/4704/comments","events_url":"https://api.github.com/repos/encode/django-rest-framework/issues/4704/events","html_url":"https://github.com/encode/django-rest-framework/issues/4704","id":191509752,"number":4704,"title":"Schema generation doesn't work if URL ends with method name","user":{"login":"mlubimow","id":2325687,"avatar_url":"https://avatars0.githubusercontent.com/u/2325687?v=4","gravatar_id":"","url":"https://api.github.com/users/mlubimow","html_url":"https://github.com/mlubimow","followers_url":"https://api.github.com/users/mlubimow/followers","following_url":"https://api.github.com/users/mlubimow/following{/other_user}","gists_url":"https://api.github.com/users/mlubimow/gists{/gist_id}","starred_url":"https://api.github.com/users/mlubimow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlubimow/subscriptions","organizations_url":"https://api.github.com/users/mlubimow/orgs","repos_url":"https://api.github.com/users/mlubimow/repos","events_url":"https://api.github.com/users/mlubimow/events{/privacy}","received_events_url":"https://api.github.com/users/mlubimow/received_events","type":"User","site_admin":false},"labels":[{"id":108601,"url":"https://api.github.com/repos/encode/django-rest-framework/labels/Bug","name":"Bug","color":"e10c02","default":false},{"id":611390077,"url":"https://api.github.com/repos/encode/django-rest-framework/labels/Schema%20Generation","name":"Schema Generation","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/encode/django-rest-framework/milestones/49","html_url":"https://github.com/encode/django-rest-framework/milestone/49","labels_url":"https://api.github.com/repos/encode/django-rest-framework/milestones/49/labels","id":2062131,"number":49,"title":"3.7.0 Release","description":"","creator":{"login":"tomchristie","id":647359,"avatar_url":"https://avatars2.githubusercontent.com/u/647359?v=4","gravatar_id":"","url":"https://api.github.com/users/tomchristie","html_url":"https://github.com/tomchristie","followers_url":"https://api.github.com/users/tomchristie/followers","following_url":"https://api.github.com/users/tomchristie/following{/other_user}","gists_url":"https://api.github.com/users/tomchristie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomchristie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomchristie/subscriptions","organizations_url":"https://api.github.com/users/tomchristie/orgs","repos_url":"https://api.github.com/users/tomchristie/repos","events_url":"https://api.github.com/users/tomchristie/events{/privacy}","received_events_url":"https://api.github.com/users/tomchristie/received_events","type":"User","site_admin":false},"open_issues":24,"closed_issues":58,"state":"open","created_at":"2016-10-11T12:50:11Z","updated_at":"2017-09-29T09:45:53Z","due_on":"2017-09-29T07:00:00Z","closed_at":null},"comments":12,"created_at":"2016-11-24T12:34:25Z","updated_at":"2017-09-29T09:58:07Z","closed_at":null,"author_association":"NONE","body":"## Steps to reproduce\r\n\r\nIf one would use urls like these (not a good practice but possible):\r\n\r\n    url(r'^test', ExampleView1.as_view()),\r\n    url(r'^test/delete/', ExampleView2.as_view()),\r\n\r\nSchema generation using rest_framework.schemas.get_schema_view will fail.\r\nI've attached minimal [test django project](https://github.com/tomchristie/django-rest-framework/files/611291/schema_bug_test.tar.gz) if anyone would like to reproduce the issue.\r\n\r\n\r\n## Expected behavior\r\n\r\nSchema should be generated as normally does.\r\n\r\n## Actual behavior\r\n\r\nThrows an exception:\r\n\r\n```\r\nEnvironment:\r\n\r\n\r\nRequest Method: GET\r\nRequest URL: http://127.0.0.1:8001/\r\n\r\nDjango Version: 1.10.3\r\nPython Version: 2.7.12\r\nInstalled Applications:\r\n['django.contrib.admin',\r\n 'django.contrib.auth',\r\n 'django.contrib.contenttypes',\r\n 'django.contrib.sessions',\r\n 'django.contrib.messages',\r\n 'django.contrib.staticfiles',\r\n 'rest_framework',\r\n 'schema_bug_test_app']\r\nInstalled Middleware:\r\n['django.middleware.security.SecurityMiddleware',\r\n 'django.contrib.sessions.middleware.SessionMiddleware',\r\n 'django.middleware.common.CommonMiddleware',\r\n 'django.middleware.csrf.CsrfViewMiddleware',\r\n 'django.contrib.auth.middleware.AuthenticationMiddleware',\r\n 'django.contrib.messages.middleware.MessageMiddleware',\r\n 'django.middleware.clickjacking.XFrameOptionsMiddleware']\r\n\r\n\r\n\r\nTraceback:\r\n\r\nFile \"/Users/mlubimow/Projects/test_project/env/lib/python2.7/site-packages/django/core/handlers/exception.py\" in inner\r\n  39.             response = get_response(request)\r\n\r\nFile \"/Users/mlubimow/Projects/test_project/env/lib/python2.7/site-packages/django/core/handlers/base.py\" in _get_response\r\n  187.                 response = self.process_exception_by_middleware(e, request)\r\n\r\nFile \"/Users/mlubimow/Projects/test_project/env/lib/python2.7/site-packages/django/core/handlers/base.py\" in _get_response\r\n  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)\r\n\r\nFile \"/Users/mlubimow/Projects/test_project/env/lib/python2.7/site-packages/django/views/decorators/csrf.py\" in wrapped_view\r\n  58.         return view_func(*args, **kwargs)\r\n\r\nFile \"/Users/mlubimow/Projects/test_project/env/lib/python2.7/site-packages/django/views/generic/base.py\" in view\r\n  68.             return self.dispatch(request, *args, **kwargs)\r\n\r\nFile \"/Users/mlubimow/Projects/test_project/env/lib/python2.7/site-packages/rest_framework/views.py\" in dispatch\r\n  477.             response = self.handle_exception(exc)\r\n\r\nFile \"/Users/mlubimow/Projects/test_project/env/lib/python2.7/site-packages/rest_framework/views.py\" in handle_exception\r\n  437.             self.raise_uncaught_exception(exc)\r\n\r\nFile \"/Users/mlubimow/Projects/test_project/env/lib/python2.7/site-packages/rest_framework/views.py\" in dispatch\r\n  474.             response = handler(request, *args, **kwargs)\r\n\r\nFile \"/Users/mlubimow/Projects/test_project/env/lib/python2.7/site-packages/rest_framework/schemas.py\" in get\r\n  593.             schema = generator.get_schema(request)\r\n\r\nFile \"/Users/mlubimow/Projects/test_project/env/lib/python2.7/site-packages/rest_framework/schemas.py\" in get_schema\r\n  242.         links = self.get_links(request)\r\n\r\nFile \"/Users/mlubimow/Projects/test_project/env/lib/python2.7/site-packages/rest_framework/schemas.py\" in get_links\r\n  276.             insert_into(links, keys, link)\r\n\r\nFile \"/Users/mlubimow/Projects/test_project/env/lib/python2.7/site-packages/rest_framework/schemas.py\" in insert_into\r\n  79.     target[keys[-1]] = value\r\n\r\nException Type: TypeError at /\r\nException Value: 'Link' object does not support item assignment\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/encode/django-rest-framework/issues/comments/333085451","html_url":"https://github.com/encode/django-rest-framework/issues/4704#issuecomment-333085451","issue_url":"https://api.github.com/repos/encode/django-rest-framework/issues/4704","id":333085451,"user":{"login":"mlubimow","id":2325687,"avatar_url":"https://avatars0.githubusercontent.com/u/2325687?v=4","gravatar_id":"","url":"https://api.github.com/users/mlubimow","html_url":"https://github.com/mlubimow","followers_url":"https://api.github.com/users/mlubimow/followers","following_url":"https://api.github.com/users/mlubimow/following{/other_user}","gists_url":"https://api.github.com/users/mlubimow/gists{/gist_id}","starred_url":"https://api.github.com/users/mlubimow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlubimow/subscriptions","organizations_url":"https://api.github.com/users/mlubimow/orgs","repos_url":"https://api.github.com/users/mlubimow/repos","events_url":"https://api.github.com/users/mlubimow/events{/privacy}","received_events_url":"https://api.github.com/users/mlubimow/received_events","type":"User","site_admin":false},"created_at":"2017-09-29T09:58:07Z","updated_at":"2017-09-29T09:58:07Z","author_association":"NONE","body":"Hey @carltongibson,\r\n\r\nI think my case may not be covered, as I've got a problem when URL contained http method name in path (like get/post/delete etc). For example: `url(r'^test/delete/', simple_fbv)`.\r\n\r\nThanks for fixing that issue! 👍 "}}
{"actor":{"display_login":"mlubimow"}}