@@ -26,7 +26,7 @@ def __init__(self, profile_attributes):
26
26
if field .name == config .ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS :
27
27
self .try_convert_structured_postal_address_to_dict (field , anchors )
28
28
29
- self .ensure_postal_address (anchors )
29
+ self .ensure_postal_address ()
30
30
31
31
@property
32
32
def date_of_birth (self ):
@@ -78,7 +78,6 @@ def get_attribute(self, attribute_name):
78
78
else :
79
79
return None
80
80
81
-
82
81
def try_convert_structured_postal_address_to_dict (self , field , anchors ):
83
82
decoder = json .JSONDecoder (object_pairs_hook = collections .OrderedDict , strict = False )
84
83
value_to_decode = field .value .decode ()
@@ -88,12 +87,14 @@ def try_convert_structured_postal_address_to_dict(self, field, anchors):
88
87
decoder .decode (value_to_decode ),
89
88
anchors )
90
89
91
- def ensure_postal_address (self , anchors ):
90
+ def ensure_postal_address (self ):
92
91
if config .ATTRIBUTE_POSTAL_ADDRESS not in self .attributes and config .ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS in self .attributes :
93
- if config .KEY_FORMATTED_ADDRESS in self .attributes [config .ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS ].value :
94
- formatted_address = self .attributes [config .ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS ].value [
92
+ structured_postal_address = self .attributes [config .ATTRIBUTE_STRUCTURED_POSTAL_ADDRESS ]
93
+
94
+ if config .KEY_FORMATTED_ADDRESS in structured_postal_address .value :
95
+ formatted_address = structured_postal_address .value [
95
96
config .KEY_FORMATTED_ADDRESS ]
96
97
self .attributes [config .ATTRIBUTE_POSTAL_ADDRESS ] = Attribute (
97
98
config .ATTRIBUTE_POSTAL_ADDRESS ,
98
99
formatted_address ,
99
- anchors )
100
+ structured_postal_address . anchors )
0 commit comments