Let custom schema node start out with empty children

sometimes that's just necessary
This commit is contained in:
Lance Edgar 2018-01-11 15:15:12 -06:00
parent f4aa83788b
commit f021df446c

View file

@ -145,10 +145,20 @@ class CustomSchemaNode(SQLAlchemySchemaNode):
msg = 'excludes and includes are mutually exclusive.'
raise ValueError(msg)
properties = sorted(self.inspector.attrs, key=_creation_order)
# sorted to maintain the order in which the attributes
# are defined
for name in includes or [item.key for item in properties]:
properties = sorted(self.inspector.attrs, key=_creation_order)
if excludes:
if includes:
raise ValueError("Must pass includes *or* excludes, but not both")
supported = [prop.key for prop in properties
if prop.key not in excludes]
elif includes:
supported = includes
elif includes is not None:
supported = []
for name in supported:
prop = self.inspector.attrs.get(name, name)
if name in excludes or (includes and name not in includes):