mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 12:30:11 +03:00
Fix for key collision
This commit is contained in:
parent
f1f657d24f
commit
50b3c05eb3
|
@ -71,9 +71,13 @@ class LinkNode(OrderedDict):
|
|||
super(LinkNode, self).__init__()
|
||||
|
||||
def get_next_key(self, method):
|
||||
current_val = self.methods_counter[method]
|
||||
self.methods_counter[method] += 1
|
||||
return '{}_{}'.format(method, current_val)
|
||||
while True:
|
||||
current_val = self.methods_counter[method]
|
||||
self.methods_counter[method] += 1
|
||||
|
||||
key = '{}_{}'.format(method, current_val)
|
||||
if key not in self:
|
||||
return key
|
||||
|
||||
|
||||
def insert_into(target, keys, value):
|
||||
|
|
Loading…
Reference in New Issue
Block a user