-
Notifications
You must be signed in to change notification settings - Fork 887
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
Cannot subclass Request and use add_request_method #1529
Comments
There's a line in the second test, |
I originally marked this as a bug because I thought you weren't able to subclass request. It appears that actually works fine. I'm not sure what the concern is here. It's entirely valid for an object to have a different list of interfaces than its class object. Can you clarify what your concern is? |
@mmerickel It is possible to subclass Request, but the provided interfaces by that subclass are no longer the same after calling set_properties. This violates expected zope.interface behaviour. If That phony class in the middle that you talk about should implement the same interfaces as the original request. Why is that important? Because if I call |
Okay I see what you're saying. I did not realize that the new class did not have the |
Okay, I was able to whittle the test down to the following, this issue has nothing to do with
What happens is that when you sub-class The way this is added by
I don't know if sub-classing From what I can gather, the reason calling |
A few things:
So I would rewrite the test like this:
which passes. I need to take a closer look at the original issue, but have to head out the door at the moment. |
@davisagli That test passes, but is not showcasing the issue that was originally reported. Specifically, when you create See this minimal test case that show cases the issue:
This does not pass. If |
Figured out that if I remove
The reason I've committed a fix for this, and will push shortly. This should hopefully fix this issue. |
This was closed by the merging of #1568. |
See this test:
This is the output from the test:
And this is the difference from a normal request to one that has been "decorated" by _set_properties:
In the first test,
test_it
, thereq
variable has 'proper' providedBy information, only by subclassing the problem appears.The text was updated successfully, but these errors were encountered: