File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,16 +51,17 @@ def get_entity_lists(
5151 if fields is None :
5252 fields = self .get_default_fields_for_type ("entityList" )
5353
54- # List does not have 'attrib' field but has 'allAttrib' field
55- # which is json string and contains only values that are set
5654 o_fields = tuple (fields )
5755 fields = set ()
5856 requires_attrib = False
5957 for field in o_fields :
6058 if field == "attrib" or field .startswith ("attrib." ):
6159 requires_attrib = True
62- field = "allAttrib"
63- fields .add (field )
60+ else :
61+ fields .add (field )
62+
63+ if requires_attrib :
64+ fields .add ("allAttrib" )
6465
6566 if "items" in fields :
6667 fields .discard ("items" )
@@ -71,7 +72,7 @@ def get_entity_lists(
7172 "items.position" ,
7273 }
7374
74- available_attribs = []
75+ available_attribs = {}
7576 if requires_attrib :
7677 available_attribs = self .get_attributes_for_type ("list" )
7778
@@ -98,13 +99,11 @@ def get_entity_lists(
9899 entity_list ["attributes" ] = json .loads (attributes )
99100
100101 if requires_attrib :
101- all_attrib = json .loads (
102- entity_list .get ("allAttrib" ) or "{}"
103- )
104- entity_list ["attrib" ] = {
105- attrib_name : all_attrib .get (attrib_name )
106- for attrib_name in available_attribs
107- }
102+ attrib = json .loads (entity_list ["allAttrib" ])
103+ for attrib_name , attrib_data in available_attribs .items ():
104+ attrib .setdefault (attrib_name , attrib_data ["default" ])
105+
106+ entity_list ["attrib" ] = attrib
108107
109108 self ._convert_entity_data (entity_list )
110109
You can’t perform that action at this time.
0 commit comments