mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-10 19:56:59 +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:
|
||||
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)
|
||||
register_converter(suffix_converter, converter_name)
|
||||
converter_name, suffix_converter = _get_format_path_converter(suffix_kwarg, allowed)
|
||||
register_converter(suffix_converter, converter_name)
|
||||
|
||||
suffix_route = '<%s:%s>' % (converter_name, suffix_kwarg)
|
||||
else:
|
||||
suffix_route = None
|
||||
suffix_route = '<%s:%s>' % (converter_name, suffix_kwarg)
|
||||
|
||||
return apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required, suffix_route)
|
||||
|
|
Loading…
Reference in New Issue
Block a user