mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-25 11:04:02 +03:00
urlpatterns: Remove unnecessary branching (#7405)
Functions path and register_converter are constants.
This commit is contained in:
parent
1e164c5eeb
commit
599e2b183d
|
@ -105,12 +105,9 @@ def format_suffix_patterns(urlpatterns, suffix_required=False, allowed=None):
|
||||||
else:
|
else:
|
||||||
suffix_pattern = r'\.(?P<%s>[a-z0-9]+)/?$' % suffix_kwarg
|
suffix_pattern = r'\.(?P<%s>[a-z0-9]+)/?$' % suffix_kwarg
|
||||||
|
|
||||||
if path and register_converter:
|
converter_name, suffix_converter = _get_format_path_converter(suffix_kwarg, allowed)
|
||||||
converter_name, suffix_converter = _get_format_path_converter(suffix_kwarg, allowed)
|
register_converter(suffix_converter, converter_name)
|
||||||
register_converter(suffix_converter, converter_name)
|
|
||||||
|
|
||||||
suffix_route = '<%s:%s>' % (converter_name, suffix_kwarg)
|
suffix_route = '<%s:%s>' % (converter_name, suffix_kwarg)
|
||||||
else:
|
|
||||||
suffix_route = None
|
|
||||||
|
|
||||||
return apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required, suffix_route)
|
return apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required, suffix_route)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user