-
Notifications
You must be signed in to change notification settings - Fork 301
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
Fixes: #476 - Overriden primary key in links #496
Conversation
try: | ||
primary_key = primary_key_for(model) | ||
if primary_key is None: | ||
raise ValueError() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to see raise ValueError
here, without the parentheses.
I think maybe the helper function Also, there are a couple other places where |
Regarding removing So, in order to do this, the design of the
Do you have any preference, or do you have a better idea? |
I've implemented the latter solution (a nested function within |
@@ -10,6 +10,8 @@ | |||
# License version 3 and under the 3-clause BSD license. For more | |||
# information, see LICENSE.AGPL and LICENSE.BSD. | |||
"""Unit tests for the :mod:`flask_restless.manager` module.""" | |||
from json import loads |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this and add the line from .helpers import loads
below the line from .helpers import force_content_type_json
. (This loads flask.json.loads
instead of json.loads
.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahaa! This is what caused the py3 breakages!
Sorry, I still haven't had much time to venture into python 3 yet :(
How about this
|
Am personally not the biggest fan of |
Haha no one is a fan of for/else! I think it works in this situation. |
OK, have pushed your solution to the branch. Sorry about the wait. |
Sorry for the inconvenience, but I just merged in some changes that makes this un-pullable. Can you |
No worries - but I'm having a crazy week here. I'll try to get around to it tomorrow, if not, it'll be friday by the time I get to do it. |
12e1da6
to
4f1ab2b
Compare
Instead of automatically taking the model's database primary key, flask-restless should use the primary key specified in the call to `create_api`, if one was specified, when generating URLs. This commit ensures this behaviour.
4f1ab2b
to
69f38ad
Compare
OK, managed to get around to it tonight. Commits are squashed into 69f38ad. |
Fixes: #476 - Overriden primary key in links
Thank you!!! |
My pleasure! If you know of other issues that are blocking the 1.0 release that I might be able to help out on, just ping me on them, and I'll try to devote some time to them on fridays. |
Issue #480. :) |
Hey, here's my solution for #476. I hope it's acceptable. If I've forgotten anything please let me know!
All enabled tests are passing on the branch: