-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Closed
Description
Checklist
- I have verified that that issue exists against the
master
branch of Django REST framework. - I have verified that that issue exists against version 3.6.2 of Django REST framework.
- I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- This is not a usage question. (Those should be directed to the discussion group instead.)
- This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
- I have reduced the issue to the simplest possible case.
- I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.)
Steps to reproduce
Use curly brackets in a regular expression of url_path argument in list_view decorator.
@list_route(url_path='?P<year>\d{4}')
or
@list_route(url_path='?P<year>[0-9]{4}')
fails, while
@list_route(url_path='?P<year>[0-9][0-9][0-9][0-9]')
works
It seems that either the use of curly brackets or of multipliers is not possible in this case.
Expected behavior
- valid url config
Actual behavior
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7fa111b426a8>
Traceback (most recent call last):
File "/xxx/.virtualenvs/my_venv/lib/python3.5/site-packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/xxx/.virtualenvs/my_venv/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
self.check(display_num_errors=True)
File "/xxx/.virtualenvs/my_venv/lib/python3.5/site-packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "/xxx/.virtualenvs/my_venv/lib/python3.5/site-packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "/xxx/.virtualenvs/my_venv/lib/python3.5/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/xxx/.virtualenvs/my_venv/lib/python3.5/site-packages/django/core/checks/urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "/xxx/.virtualenvs/my_venv/lib/python3.5/site-packages/django/core/checks/urls.py", line 26, in check_resolver
return check_method()
File "/xxx/.virtualenvs/my_venv/lib/python3.5/site-packages/django/urls/resolvers.py", line 254, in check
for pattern in self.url_patterns:
File "/xxx/.virtualenvs/my_venv/lib/python3.5/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/xxx/.virtualenvs/my_venv/lib/python3.5/site-packages/django/urls/resolvers.py", line 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/xxx/.virtualenvs/my_venv/lib/python3.5/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/xxx/.virtualenvs/my_venv/lib/python3.5/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
return import_module(self.urlconf_name)
File "/xxx/.virtualenvs/my_venv/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/xxx/my_project/my_project/urls.py", line 21, in <module>
url(r'^users/', include('profiles.urls')),
File "/xxx/.virtualenvs/my_venv/lib/python3.5/site-packages/django/conf/urls/__init__.py", line 50, in include
urlconf_module = import_module(urlconf_module)
File "/xxx/.virtualenvs/my_venv/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/xxx/temp/my_venv/profiles/urls.py", line 17, in <module>
url(r'', include(router.urls)),
File "/xxx/.virtualenvs/my_venv/lib/python3.5/site-packages/rest_framework/routers.py", line 82, in urls
self._urls = self.get_urls()
File "/xxx/.virtualenvs/my_venv/lib/python3.5/site-packages/rest_framework/routers.py", line 372, in get_urls
urls = super(DefaultRouter, self).get_urls()
File "/xxx/.virtualenvs/my_venv/lib/python3.5/site-packages/rest_framework/routers.py", line 261, in get_urls
trailing_slash=self.trailing_slash
IndexError: tuple index out of range
Metadata
Metadata
Assignees
Labels
No labels