-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Borked interface resolution order for boolean field #80
Comments
@jamadden I think you probably have a good idea on how to fix this given your recent work on the |
This is the case for many of the fields, including classImplements(Text, IText)
classImplements(TextLine, ITextLine)
classImplements(Password, IPassword)
classImplements(Bool, IBool)
classImplements(Iterable, IIterable)
classImplements(Container, IContainer)
classImplements(Number, INumber)
classImplements(Complex, IComplex)
classImplements(Real, IReal)
classImplements(Rational, IRational)
classImplements(Integral, IIntegral)
classImplements(Int, IInt)
classImplements(Object, IObject) e.g., for Text: >>> from zope.schema import Text
>>> list(providedBy(Text()).flattened())
[<InterfaceClass zope.schema._bootstrapinterfaces.IFromUnicode>,
<InterfaceClass zope.schema.interfaces.IText>,
<InterfaceClass zope.schema.interfaces.IMinMaxLen>,
<InterfaceClass zope.schema.interfaces.ILen>,
<InterfaceClass zope.schema.interfaces.IIterable>,
<InterfaceClass zope.schema.interfaces.IField>,
<InterfaceClass zope.schema._bootstrapinterfaces.IValidatable>,
<InterfaceClass zope.interface.interfaces.IAttribute>,
<InterfaceClass zope.interface.interfaces.IElement>,
<InterfaceClass zope.interface.Interface>] It has been done this way since at least 3.4.0. I'm not sure what else can be done. |
Seems like a big problem to me -- it means that an adapter registered for |
Would it help if IText et al explicitly inherited IFromUnicode and similar "mixin" interfaces? |
It seems to me those are properties of the implementation of the field, not the contract of its interface. OK, I think The other option I can think of is to remove all the |
No, not really. It just sticks whatever you give it on the end of the list of things already directly implemented. That can lead to really messed up IROs in the case of inheritance (I had to tweak it for that reason in zopefoundation/zope.interface#182, but that doesn't solve the issue here) . Arguably it should put what you're giving it at the front of the list, or at the very least you should get to choose (probably a separate function). I mean, you can go back in and manually fix it by re-arranging |
And test this. Fixes #80. Add Python 3.8, drop Python 3.4.
And test this. Fixes #80. Add Python 3.8, drop Python 3.4.
And test this. Fixes #80. Add Python 3.8, drop Python 3.4.
And test this. Fixes #80. Add Python 3.8, drop Python 3.4.
If I take a boolean field I would expect IBool to be the first interface,compare the output of the field
__iro__
with other fields.This prevents to register specific adaters for the IBool interface, see https://github.com/plone/plone.rfc822/pull/6/files#diff-13c585cfb8d0755a94087390ae8b22e4R30
The text was updated successfully, but these errors were encountered: