Skip to content
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

TypeError: <lambda>() got an unexpected keyword argument 'page' #304

Closed
svenstaro opened this issue Mar 27, 2014 · 12 comments
Closed

TypeError: <lambda>() got an unexpected keyword argument 'page' #304

svenstaro opened this issue Mar 27, 2014 · 12 comments
Labels

Comments

@svenstaro
Copy link

@svenstaro svenstaro commented Mar 27, 2014

I'm getting

TypeError: <lambda>() got an unexpected keyword argument 'page'

upon running the example quickstart.py with Python 3.4. It's also broken on Python 2.7. I consider this a problem of this library. It's only a problem since the commit that merges in the mimerender pull request.

@svenstaro
Copy link
Author

@svenstaro svenstaro commented Mar 28, 2014

Seems to wrong usage of minerender on top of a mimerender problem due to the changes to functools.update_wrapper() listed here. Will report to mimerender. You should be able to work around this by changing the way you use mimerender.

Loading

@jfinkels
Copy link
Owner

@jfinkels jfinkels commented Apr 4, 2014

I'm not getting that error on Python 2.7. I'll try to install Python 3.4 and check it out (it's not available in Ubuntu yet; it's only available through the deadsnakes repository).

Loading

@jfinkels
Copy link
Owner

@jfinkels jfinkels commented Apr 4, 2014

I don't seem to be getting this error with Python 3.4 either. Are you getting this at the time you run the quickstart.py server, or after making some requests? What sequence of requests causes your error? Can you provide the full stack trace of the error?

Loading

@svenstaro
Copy link
Author

@svenstaro svenstaro commented Apr 6, 2014

This is very weird, or maybe I just don't understand the problem. Steps to reproduce:

cd /tmp
virtualenv-3.4 env
source env/bin/activate
wget https://raw.githubusercontent.com/jfinkels/flask-restless/master/examples/quickstart.py
pip install flask-restless flask-sqlalchemy
python quickstart.py
curl http://0.0.0.0:5000/api/person

This actually works fine using curl and gives back the expected json! However, accessing that exact resource with a browser results in this:http://pastebin.com/bA7c54pk

The same works fine using a browser with python 2.7. I still consider it a bug.

Loading

@jie
Copy link

@jie jie commented Apr 7, 2014

I think the exception cause by there is no xml render for mimerender, and browser's Accept is xml

  mimerender = FlaskMimeRender()(default='json', json=jsonpify,
                               xml=lambda: None)  # TODO fill in xml renderer

Loading

@mhils
Copy link
Contributor

@mhils mhils commented Apr 7, 2014

@jie is right. This should probaby be fixed ASAP as it's broken with Chrome by default.

Quick fix:

-                               xml=lambda: None)  # TODO fill in xml renderer
+                               )  # TODO fill in xml renderer

Loading

@jfinkels
Copy link
Owner

@jfinkels jfinkels commented Apr 7, 2014

Interesting. Can someone make a quick pull request for the change proposed above?

I'd love to see a test case for this, but if that is too tricky, just the quick fix is fine.

Loading

@jfinkels jfinkels added the bug label Apr 7, 2014
mhils added a commit to mhils/flask-restless that referenced this issue Apr 8, 2014
remove xml renderer stub
@mhils mhils mentioned this issue Apr 8, 2014
@mhils
Copy link
Contributor

@mhils mhils commented Apr 8, 2014

Hi there,

PR is out. I'd be pleased if that could be released quickly. I have a demo showing the simplicity of Flask-Restless on Friday, I'd love to avoid cluttering it with this workaround.

Thanks!
Max

Loading

@mhils
Copy link
Contributor

@mhils mhils commented Apr 8, 2014

@jie: Just realized that you already posted a PR two hours ago - sorry, it wasn't referenced here and I just saw it now.

Loading

@svenstaro
Copy link
Author

@svenstaro svenstaro commented Apr 13, 2014

Well, so are you gonna merge some pull requests?

Loading

@jfinkels
Copy link
Owner

@jfinkels jfinkels commented Apr 22, 2014

Sorry for the delay. I will publish an incremental version right now.

Loading

@jfinkels
Copy link
Owner

@jfinkels jfinkels commented Apr 22, 2014

Should be available as version 0.13.1. Please check it out.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants