Skip to content

Commit

Permalink
Merge pull request #27 from plone/dx-siteroot
Browse files Browse the repository at this point in the history
Dx siteroot
  • Loading branch information
jensens authored Aug 26, 2021
2 parents af90845 + d99d51d commit e9bdb78
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/27.breaking
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make finalizeSchema more robust by not handling behavior schema classes
18 changes: 16 additions & 2 deletions plone/supermodel/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,22 @@ def finalizeSchemas(parent=Schema):
)

def walk(schema):
yield schema
for child in schema.dependents.keys():
# When we have behaviors on the Plone site root we got some shcmeas that
# are not SchemaClasses
if isinstance(schema, SchemaClass):
yield schema

# This try..except is to handle AttributeError:
# 'VerifyingAdapterLookup' object has no attribute 'dependents'.
# afaik this happens in tests only.
# We have issue https://github.com/plone/plone.supermodel/issues/14
# to find out why this is happening in the first place.
try:
children = schema.dependents.keys()
except AttributeError:
children = ()

for child in children:
for s in walk(child):
yield s

Expand Down

0 comments on commit e9bdb78

Please sign in to comment.