3131 get_uuid ,
3232 is_empty ,
3333 namespace_from_full_title ,
34- remove_empty_strings ,
34+ remove_empty ,
3535 title_from_full_title ,
3636)
3737from osw .wiki_tools import SearchParam
@@ -605,8 +605,9 @@ class LoadEntityParam(BaseModel):
605605 autofetch_schema : Optional [bool ] = True
606606 """If true, load the corresponding schemas /
607607 categories ad-hoc if not already present"""
608- remove_empty_strings : Optional [bool ] = True
609- """If true, remove key with an empty string value from the jsondata."""
608+ remove_empty : Optional [bool ] = True
609+ """If true, remove key with an empty string, list, dict or set as value
610+ from the jsondata."""
610611 disable_cache : bool = False
611612 """If true, disable the cache for the loading process"""
612613
@@ -662,8 +663,8 @@ def load_entity(
662663 schemas = []
663664 schemas_fetched = True
664665 jsondata = page .get_slot_content ("jsondata" )
665- if param .remove_empty_strings :
666- remove_empty_strings (jsondata )
666+ if param .remove_empty :
667+ remove_empty (jsondata )
667668 if jsondata :
668669 for category in jsondata ["type" ]:
669670 schema = (
@@ -780,7 +781,7 @@ class _ApplyOverwriteParam(OswBaseModel):
780781 namespace : Optional [str ]
781782 meta_category_title : Optional [str ]
782783 meta_category_template_str : Optional [str ]
783- remove_empty_strings : Optional [bool ] = True
784+ remove_empty : Optional [bool ] = True
784785 inplace : Optional [bool ] = False
785786 debug : Optional [bool ] = False
786787
@@ -861,8 +862,8 @@ def set_content(content_to_set: dict) -> None:
861862 ):
862863 # Use pydantic serialization, skip none values:
863864 new_content ["jsondata" ] = json .loads (param .entity .json (exclude_none = True ))
864- if param .remove_empty_strings :
865- remove_empty_strings (new_content ["jsondata" ])
865+ if param .remove_empty :
866+ remove_empty (new_content ["jsondata" ])
866867 set_content (new_content )
867868 page .changed = True
868869 return page # Guard clause --> exit function
@@ -892,8 +893,8 @@ def set_content(content_to_set: dict) -> None:
892893 for slot in ["jsondata" , "header" , "footer" ]: # SLOTS:
893894 remote_content [slot ] = page .get_slot_content (slot )
894895 # Todo: remote content does not contain properties that are not set
895- if param .remove_empty_strings :
896- remove_empty_strings (remote_content ["jsondata" ])
896+ if param .remove_empty :
897+ remove_empty (remote_content ["jsondata" ])
897898 if remote_content ["header" ]: # not None or {} or ""
898899 new_content ["header" ] = remote_content ["header" ]
899900 if remote_content ["footer" ]:
@@ -904,8 +905,8 @@ def set_content(content_to_set: dict) -> None:
904905 # Properties that are not set in the local content will be set to None
905906 # We want those not to be listed as keys
906907 local_content ["jsondata" ] = json .loads (param .entity .json (exclude_none = True ))
907- if param .remove_empty_strings :
908- remove_empty_strings (local_content ["jsondata" ])
908+ if param .remove_empty :
909+ remove_empty (local_content ["jsondata" ])
909910 if param .debug :
910911 print (f"'local_content': { str (remote_content )} " )
911912 # Apply the overwrite logic
@@ -981,7 +982,7 @@ class StoreEntityParam(OswBaseModel):
981982 """A list of OverwriteClassParam objects. If a class specific overwrite setting
982983 is set, this setting is used.
983984 """
984- remove_empty_strings : Optional [bool ] = True
985+ remove_empty : Optional [bool ] = True
985986 """If true, remove key with an empty string value from the jsondata."""
986987 change_id : Optional [str ] = None
987988 """ID to document the change. Entities within the same store_entity() call will
@@ -1101,15 +1102,15 @@ def store_entity_(
11011102 namespace = namespace_ ,
11021103 policy = overwrite_class_param ,
11031104 meta_category_template_str = meta_category_template_str ,
1104- remove_empty_strings = param .remove_empty_strings ,
1105+ remove_empty = param .remove_empty ,
11051106 debug = param .debug ,
11061107 )
11071108 )
11081109 if meta_category_template :
11091110 try :
11101111 jsondata = page .get_slot_content ("jsondata" )
1111- if param .remove_empty_strings :
1112- remove_empty_strings (jsondata )
1112+ if param .remove_empty :
1113+ remove_empty (jsondata )
11131114 schema_str = eval_compiled_handlebars_template (
11141115 meta_category_template ,
11151116 jsondata ,
0 commit comments