use class from self.__class__ when serializing BackLinks with fetched data#1207
use class from self.__class__ when serializing BackLinks with fetched data#1207alexdlukens wants to merge 2 commits intoBeanieODM:mainfrom
Conversation
337d6f7 to
80da15b
Compare
maybe a getattr(self, "document_class", self.class) instead ? With attribute: Without attribute: this is what i got with a testing script (using timeit) |
This is the case when BackLink data has been fetched using fetch_links=True
80da15b to
2685fae
Compare
|
This PR is stale because it has been open 45 days with no activity. |
|
This PR is stale because it has been open 45 days with no activity. |
|
This PR is stale because it has been open 45 days with no activity. |
|
The fix looks correct - using self.class instead of the hardcoded Document class when serializing BackLinks with fetched data makes sense. However, the mergeability is currently marked as unknown, likely needs a rebase. Could you rebase against main? |
roman-right
left a comment
There was a problem hiding this comment.
Thanks for the fix and the tests, LGTM.
This is my proposed solution for #1189. Please find the minimal code example in the issue report.
This fixes serialization in the case when BackLink data has been fetched using
fetch_links=True. In this situation, the BackLink field contains aDocumentobject, which does not have thedocument_classattribute.Thanks,