diff --git a/gramps/gen/lib/address.py b/gramps/gen/lib/address.py index 90370e4b18..6bc1de7682 100644 --- a/gramps/gen/lib/address.py +++ b/gramps/gen/lib/address.py @@ -117,10 +117,7 @@ def get_schema(cls): "title": _("Notes"), "items": {"type": "string", "maxLength": 50}, }, - "date": { - "oneOf": [{"type": "null"}, Date.get_schema()], - "title": _("Date"), - }, + "date": Date.get_schema(), "street": {"type": "string", "title": _("Street")}, "locality": {"type": "string", "title": _("Locality")}, "city": {"type": "string", "title": _("City")}, diff --git a/gramps/gen/lib/baseobj.py b/gramps/gen/lib/baseobj.py index 0a10bd7209..045af55979 100644 --- a/gramps/gen/lib/baseobj.py +++ b/gramps/gen/lib/baseobj.py @@ -67,11 +67,10 @@ def get_object_state(self): properties to be saved. This method is called to provide the information required to serialize - the object. If None is returned then the object will be represented as - null in JSON. + the object. :returns: Returns a dictionary of attributes that represent the state - of the object or None. + of the object. :rtype: dict """ attr_dict = dict( diff --git a/gramps/gen/lib/citation.py b/gramps/gen/lib/citation.py index 8e919dd7ab..7e7a7246b5 100644 --- a/gramps/gen/lib/citation.py +++ b/gramps/gen/lib/citation.py @@ -113,10 +113,7 @@ def get_schema(cls): "title": _("Handle"), }, "gramps_id": {"type": "string", "title": _("Gramps ID")}, - "date": { - "oneOf": [{"type": "null"}, Date.get_schema()], - "title": _("Date"), - }, + "date": Date.get_schema(), "page": {"type": "string", "title": _("Page")}, "confidence": { "type": "integer", diff --git a/gramps/gen/lib/date.py b/gramps/gen/lib/date.py index 34c5a39eba..81d942174f 100644 --- a/gramps/gen/lib/date.py +++ b/gramps/gen/lib/date.py @@ -750,17 +750,6 @@ def unserialize(self, data): raise DateError("Invalid date to unserialize") return self - def get_object_state(self): - """ - Get the current object state as a dictionary. - - We override this method to represent an empty date as null in JSON. - """ - if self.is_empty() and not self.text: - return None - else: - return super().get_object_state() - def set_object_state(self, attr_dict): """ Set the current object state using information provided in the given diff --git a/gramps/gen/lib/event.py b/gramps/gen/lib/event.py index 464b3a297b..f768de8042 100644 --- a/gramps/gen/lib/event.py +++ b/gramps/gen/lib/event.py @@ -183,10 +183,7 @@ def get_schema(cls): }, "gramps_id": {"type": "string", "title": _("Gramps ID")}, "type": EventType.get_schema(), - "date": { - "oneOf": [{"type": "null"}, Date.get_schema()], - "title": _("Date"), - }, + "date": Date.get_schema(), "description": {"type": "string", "title": _("Description")}, "place": { "type": ["string", "null"], diff --git a/gramps/gen/lib/ldsord.py b/gramps/gen/lib/ldsord.py index 8515fc701d..df11723c5a 100644 --- a/gramps/gen/lib/ldsord.py +++ b/gramps/gen/lib/ldsord.py @@ -196,10 +196,7 @@ def get_schema(cls): "title": _("Notes"), "items": {"type": "string", "maxLength": 50}, }, - "date": { - "oneOf": [{"type": "null"}, Date.get_schema()], - "title": _("Date"), - }, + "date": Date.get_schema(), "type": {"type": "integer", "title": _("Type")}, "place": {"type": "string", "title": _("Place")}, "famc": {"type": ["null", "string"], "title": _("Family")}, diff --git a/gramps/gen/lib/media.py b/gramps/gen/lib/media.py index 3f55964653..684785d64d 100644 --- a/gramps/gen/lib/media.py +++ b/gramps/gen/lib/media.py @@ -169,10 +169,7 @@ def get_schema(cls): "title": _("Notes"), }, "change": {"type": "integer", "title": _("Last changed")}, - "date": { - "oneOf": [{"type": "null"}, Date.get_schema()], - "title": _("Date"), - }, + "date": Date.get_schema(), "tag_list": { "type": "array", "items": {"type": "string", "maxLength": 50}, diff --git a/gramps/gen/lib/name.py b/gramps/gen/lib/name.py index 79c4541344..24cbf9d32d 100644 --- a/gramps/gen/lib/name.py +++ b/gramps/gen/lib/name.py @@ -177,10 +177,7 @@ def get_schema(cls): "items": {"type": "string", "maxLength": 50}, "title": _("Notes"), }, - "date": { - "oneOf": [{"type": "null"}, Date.get_schema()], - "title": _("Date"), - }, + "date": Date.get_schema(), "first_name": {"type": "string", "title": _("Given name")}, "surname_list": { "type": "array", diff --git a/gramps/gen/lib/placename.py b/gramps/gen/lib/placename.py index 8c2de67cc5..23b30ef6ef 100644 --- a/gramps/gen/lib/placename.py +++ b/gramps/gen/lib/placename.py @@ -96,10 +96,7 @@ def get_schema(cls): "properties": { "_class": {"enum": [cls.__name__]}, "value": {"type": "string", "title": _("Text")}, - "date": { - "oneOf": [{"type": "null"}, Date.get_schema()], - "title": _("Date"), - }, + "date": Date.get_schema(), "lang": {"type": "string", "title": _("Language")}, }, } diff --git a/gramps/gen/lib/placeref.py b/gramps/gen/lib/placeref.py index 8e1486c9db..c57396513c 100644 --- a/gramps/gen/lib/placeref.py +++ b/gramps/gen/lib/placeref.py @@ -93,10 +93,7 @@ def get_schema(cls): "title": _("Handle"), "maxLength": 50, }, - "date": { - "oneOf": [{"type": "null"}, Date.get_schema()], - "title": _("Date"), - }, + "date"Date.get_schema(), }, }