File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -703,6 +703,17 @@ def get_entities_from_osw(
703703    entities_from_osw: 
704704        List of entities from OSW. 
705705    """ 
706+ 
707+     def  test_if_empty_list_or_none (obj ) ->  bool :
708+         if  obj  is  None :
709+             return  True 
710+         elif  isinstance (obj , list ):
711+             if  len (obj ) ==  0 :
712+                 return  True 
713+             elif  len ([item  for  item  in  obj  if  item  is  not None ]) ==  0 :
714+                 return  True 
715+         return  False 
716+ 
706717    if  isinstance (category_to_search , str ):
707718        category_uuid  =  category_to_search .split ("OSW" )[- 1 ]
708719    else :  # elif isinstance(category_to_search, uuid_module.UUID): 
@@ -726,7 +737,10 @@ def get_entities_from_osw(
726737        if  page .exists :
727738            jsondata  =  page .get_slot_content ("jsondata" )
728739            jsondata ["full_page_title" ] =  entity 
729-             entities_from_osw .append (model_to_cast_to (** jsondata ))
740+             kwargs  =  {
741+                 k : v  for  k , v  in  jsondata .items () if  not  test_if_empty_list_or_none (v )
742+             }
743+             entities_from_osw .append (model_to_cast_to (** kwargs ))
730744    return  entities_from_osw 
731745
732746
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments