Skip to content

Commit 407904c

Browse files
committed
refactor
1 parent 8c0b6f1 commit 407904c

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/satosa/micro_services/attribute_generation.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
import pystache
33

44
from .base import ResponseMicroService
5-
6-
def _config(f, requester, provider):
7-
pf = f.get(provider, f.get("", f.get("default", {})))
8-
rf = pf.get(requester, pf.get("", pf.get("default", {})))
9-
return rf.items()
5+
from ..util import get_dict_defaults
106

117
class MustachAttrValue(object):
128
def __init__(self, attr_name, values):
@@ -132,8 +128,8 @@ def _synthesize(self, attributes, requester, provider):
132128
for attr_name,values in attributes.items():
133129
context[attr_name] = MustachAttrValue(attr_name, values)
134130

135-
recipes = _config(self.synthetic_attributes, requester, provider)
136-
for attr_name, fmt in recipes:
131+
recipes = get_dict_defaults(self.synthetic_attributes, requester, provider)
132+
for attr_name, fmt in recipes.items():
137133
syn_attributes[attr_name] = [v.strip().strip(';') for v in re.split("[;\n]+", pystache.render(fmt, context))]
138134
return syn_attributes
139135

0 commit comments

Comments
 (0)