Skip to content

core: recursion to get deepest child#20325

Merged
dominic-r merged 1 commit intosdko/provider-type-fix-ldapfrom
core/recursion-to-get-deepest-child
Feb 16, 2026
Merged

core: recursion to get deepest child#20325
dominic-r merged 1 commit intosdko/provider-type-fix-ldapfrom
core/recursion-to-get-deepest-child

Conversation

@gergosimonyi
Copy link
Collaborator

@gergosimonyi gergosimonyi requested a review from a team as a code owner February 16, 2026 12:39
@netlify
Copy link

netlify bot commented Feb 16, 2026

Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 48ca3c0
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/69930fed5842520008347ba3
😎 Deploy Preview https://deploy-preview-20325--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@dominic-r dominic-r merged commit 8639a04 into sdko/provider-type-fix-ldap Feb 16, 2026
9 checks passed
@dominic-r dominic-r deleted the core/recursion-to-get-deepest-child branch February 16, 2026 14:08
Comment on lines +33 to +37
try:
child = getattr(parent, submodel)
break
except AttributeError:
continue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be a hasattr probably, this isn't directly in the hotpath but could be quite likely involved in it and throwing exceptions just for that is wasteful

Copy link
Collaborator Author

@gergosimonyi gergosimonyi Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wager we'll save about a microsecond per execution with

Suggested change
try:
child = getattr(parent, submodel)
break
except AttributeError:
continue
if hasattr(parent, submodel):
child = parent.submodel
break

:)

dominic-r pushed a commit that referenced this pull request Feb 27, 2026
add recursive approach to get deepest child object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants