forked from orbit-oss/flask
Utilise defaultdicts
This code originates from the Python 2.4 supporting version of Flask, with defaultdicts being added in 2.5. Using defaultdict makes the intentional usage clearer, and slightly simplifies the code.
This commit is contained in:
parent
5fea7caba2
commit
fd62210f58
3 changed files with 23 additions and 21 deletions
|
|
@ -251,7 +251,7 @@ class Blueprint(Scaffold):
|
|||
"""
|
||||
for key, values in self_dict.items():
|
||||
key = self.name if key is None else f"{self.name}.{key}"
|
||||
app_dict.setdefault(key, []).extend(values)
|
||||
app_dict[key].extend(values)
|
||||
|
||||
def merge_dict_nested(self_dict, app_dict):
|
||||
"""Merges self_dict into app_dict. Replaces None keys with self.name.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue