2828
2929import gramps
3030import jsonschema
31- from flask import abort
31+ from flask import abort , current_app
3232from gramps .gen .const import GRAMPS_LOCALE as glocale
3333from gramps .gen .db import KEY_TO_CLASS_MAP , DbTxn
3434from gramps .gen .db .base import DbReadBase , DbWriteBase
@@ -813,7 +813,8 @@ def validate_object_dict(obj_dict: Dict[str, Any]) -> bool:
813813 obj_dict_fixed = {k : v for k , v in obj_dict .items () if k != "complete" }
814814 try :
815815 jsonschema .validate (obj_dict_fixed , schema )
816- except jsonschema .exceptions .ValidationError :
816+ except jsonschema .exceptions .ValidationError as exc :
817+ current_app .log_exception (exc )
817818 return False
818819 return True
819820
@@ -837,7 +838,10 @@ def fix_object_dict(object_dict: Dict, class_name: Optional[str] = None):
837838 k == "name" and class_name == "StyledTextTag"
838839 ):
839840 if isinstance (v , str ):
840- d_out [k ] = {"_class" : f"{ class_name } Type" , "string" : _ (v )}
841+ if class_name == "Family" :
842+ d_out [k ] = {"_class" : f"{ class_name } RelType" , "string" : _ (v )}
843+ else :
844+ d_out [k ] = {"_class" : f"{ class_name } Type" , "string" : _ (v )}
841845 else :
842846 d_out [k ] = v
843847 elif k == "role" :
@@ -861,6 +865,8 @@ def fix_object_dict(object_dict: Dict, class_name: Optional[str] = None):
861865 else item
862866 for item in v
863867 ]
868+ elif k in ["complete" ]:
869+ pass
864870 else :
865871 d_out [k ] = v
866872 return d_out
0 commit comments