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
Compatibility problems between 0.9 - 0.10? #796
Comments
same as #795 ? |
The root cause seems to be the same. The odd part is that it is working in other setups. Right now I think it might be related to some change between 0.9 and 0.10. But I have no access to the 0.9 version to test it. |
Check out #794, it looks like you may be running into the 'feature' introduced by the fix for issue #570. I have code written for Flask 0.8 that breaks when I try to use 0.10. To resolve #570, an assertion was added that conflicts with anything that causes two endpoints to have the same apparent name. There is a fix in the dev release that may work for you if you aren't using method views. Otherwise you may need to force pip to use 0.9. |
Thank you, #794 really seems to be about the same issue. I've been trying to force pip to use 0.9, but it will download 0.10 anyway. Don't know if something's wrong with 0.9. I'll try to install 0.8 then and see if it fixes it. |
Trying to install 0.8 through pip also resulted in installing 0.10. So I installed it through the repo code. So for reference, if somebody wants to solve this problem:
So my problem was solved and the issue in 0.10 is already described in #794. The only remaining problem is that trying to install older versions through pip doesn't work. Don't know if that's a problem with flask or pip, so don't know if this issue may be closed already. |
Note that this is not a bug, it's intended behavior and will not change. If you run into this you are probably causing a bug somewhere. Can you give a testcase for how you trigger it? |
Why would this be intended behavior? For example, I am using Flask-Restless and want two endpoints URIs to point to the same view function. I iterate through a list of the URIs and as I add resources, I get this error since they are pointing to the same function. What is the advantage created by this over the previous behavior? |
@sibblegp This code will now raise an exception:
When i use Flask 0.9, the code above will return "foo" for requesting "/". |
Okay, I see the issue. However, that's a namespace problem where you have two functions conflicting against each other. I should still be able to map a view function to as many routes as I want. This is kind of solving it in the wrong way IMHO. |
Sorry to dredge up an old issue, but does this mean that I can't have multiple routes go to the same function? Eg. GET /users @app.route('/show', methods=['GET']) I thought this was allowed practice (and have applications that have this in place). If this is now disallowed, is the only way to retain this functionality by downgrading to 0.8? Thanks much |
@cybertoast : You can still do that. It's allowed unless you try to use the same endpoint name for two different functions (which usually is a copy&paste bug) |
Okay I'm using a decorator to wrap my api functions like:
tools.api.response returns a function that wraps stuff around thing, so im getting this error. |
@chaosagent without seeing your decorator, that isn't a very useful message, but you're probably not using |
@davidism Thanks, but that ended up not having a name attribute altogether.
|
|
@ThiefMaster Thanks, that worked. |
Why exactly is Trying something like: class SomeMiddleware:
def __init__(self, app, path):
self.app = app
app.add_url_rule(path, view_func=self.run)
def run(self):
...
app = Flask()
SomeMiddleware('/path1', app)
SomeMiddleware('/path2', app) # raises this error How should this be tackled - have caller provide endpoint name? Or generate UUID as it? Or use route (hash) as endpoint name? |
Nevermind, while I didn't find this from Flask docs, it's well described here: https://stackoverflow.com/a/19262349/165629. So I guess if there's no harm doing |
I'm getting the following error in flask 0.10:
AssertionError: View function mapping is overwriting an existing endpoint function: etc
The other members of the project, who have configured their environment earlier, are not getting this error. The requirements.txt file is requesting flask 0.9, but whenever I try to install that version, I end up having 0.10.
So I'm assuming that the difference between their environment and mine is that version number (since that error is related to flask). So are there new features in 0.10 that break apps developed for 0.9? And how can I install 0.9? It looks like the 0.9 branch is missing in the repo.
The text was updated successfully, but these errors were encountered: