Added schema to Note and StyledText

This commit is contained in:
Doug Blank 2016-01-30 14:25:51 -05:00
parent ae8572187e
commit 3b1ff1e30f
2 changed files with 26 additions and 0 deletions

View File

@ -125,6 +125,22 @@ class Note(BasicPrimaryObject):
"tag_list": TagBase.to_struct(self),
"private": self.private}
@classmethod
def get_schema(cls):
"""
The schema for Note.
"""
return {
"handle": Handle("Note", "NOTE-HANDLE"),
"gramps_id": str,
"text": StyledText,
"format": int,
"type": NoteType,
"change": int,
"tag_list": [Handle("Tag", "TAG-HANDLE")],
"private": bool,
}
@classmethod
def from_struct(cls, struct):
"""

View File

@ -329,6 +329,16 @@ class StyledText(object):
[StyledTextTag.from_struct(t)
for t in struct.get("tags", default.tags)])
@classmethod
def get_schema(cls):
"""
The schema for StyledText.
"""
return {
"string": str,
"tags": [StyledTextTag],
}
def unserialize(self, data):
"""
Convert a serialized tuple of data to an object.