Struct.from_struct is also a classmethod
This commit is contained in:
parent
74f9fb1b8e
commit
f4af5277e6
@ -308,13 +308,17 @@ class Struct(object):
|
||||
add_func = self.db._tables[name]["add_func"]
|
||||
add_func(new_obj, trans)
|
||||
|
||||
def from_struct(self):
|
||||
@classmethod
|
||||
def from_struct(self, struct=None):
|
||||
"""
|
||||
Given a struct with metadata, create a Gramps object.
|
||||
|
||||
self is class when called as a classmethod.
|
||||
"""
|
||||
from gramps.gen.lib import (Person, Family, Event, Source, Place, Citation,
|
||||
Repository, MediaObject, Note, Tag, Date)
|
||||
struct = self.struct
|
||||
if struct is None:
|
||||
struct = self.struct
|
||||
if isinstance(struct, dict):
|
||||
if "_class" in struct.keys():
|
||||
if struct["_class"] == "Person":
|
||||
|
Loading…
Reference in New Issue
Block a user