Closed jhamman closed 1 year ago
This is such a weird problem. In the Pydantic code, it is used against the class, not the instance:
return objtype.__getattribute__(objtype, self._name)
This causes an error. I'm trying to handle this, but I'm not sure if it will work soon.
Ah, no. It looks like I figured out how to handle this. Please, try https://github.com/roman-right/beanie/pull/669
Thanks for the quick response @roman-right - testing this out now.
@roman-right - the changes in #669 seem to have unblocked me. Looking forward to seeing that release out in the wild!
Describe the bug I am upgrading to Pydantic 2.0 and am hitting a surprising error. If my
beanie.Document
has a custom method on it wrapped invalidate_call
, Beanie fails to initialize.To Reproduce
This raises the following error:
Expected behavior I expect that Beanie is able to initialize Documents with custom methods on them. (this approach worked with Pydantic 1)
Additional context Version info: python : 3.10 beanie : 1.21.0 pydantic : 2.3.0 motor : 3.3.1