On Monday 11 April 2016 20:13:02 Florian Apolloner wrote: > On Monday, April 11, 2016 at 6:57:46 PM UTC+2, Tim Graham wrote: > > I cannot think of much we could do besides monkey-patching the > > custom-user model. > > I would not call checking and rewriting the class in __new__ > monkey-patching, but…
I think this is what we must do in order to keep backwards-compatibility while resolving the issue. If we don't resolve the issue, people will just keep using the method as if it were a property, opening themselves up in various ways; If we just make it a property in the builtin classes, custom user classes will re-introduce the issue. We can handle it in two ways, as far as I can see: A) What Florian alluded to above -- give AbstractBaseUser a metaclass which replaces the methods with Aymeric's "CallableBool"s B) Implement in AbstractBaseUser a __getattribute__ which, essentially, does the same thing when asked for the methods. When idea which I discarded was to "force" the attributes to be used as methods -- to use a callable which raises an exception when evaluated as boolean. But this replacement suffers exactly the same problems as the CallableBool replacement, unless also supported by "monkey patching" techniques, and a CallableBool is much more user-friendly. Have fun, Shai.