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

sometime meta not works #4

Closed
didlawowo opened this issue May 25, 2020 · 2 comments
Closed

sometime meta not works #4

didlawowo opened this issue May 25, 2020 · 2 comments

Comments

@didlawowo
Copy link

didlawowo commented May 25, 2020

works on validation

(.venv) C:\Users\xxxxxx\Documents\gits\fid-forward>curl -i  http://127.0.0.1:5000/api/v1/validation/meta
HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 763
Server: Werkzeug/1.0.1 Python/3.7.0
Date: Mon, 25 May 2020 12:32:57 GMT

{"description": null, "fields": [{"description": null, "key": true, "name": "id", "nullable": false, "type": "int", "unique": null}, {"description": null, "key": false, "name": "validation_date",
"nullable": true, "type": "datetime", "unique": null}, {"description": null, "key": false, "name": "comment", "nullable": true, "type": "str", "unique": null}, {"description": null, "key": false,
"name": "status", "nullable": true, "type": "str", "unique": null}, {"description": null, "key": false, "name": "id_user", "nullable": true, "type": "int", "unique": null}], "methods": ["HEAD", "F
ETCH", "DELETE", "PATCH", "POST", "GET", "PUT", "OPTIONS"], "name": "validation", "related": {"demand": "/api/v1/demand", "user": "/api/v1/user"}, "url": "/api/v1/validation"}

not works on application

(.venv) C:\Users\xxxxx\Documents\gits\fid-forward>curl -i  http://127.0.0.1:5000/api/v1/application/meta
HTTP/1.0 500 INTERNAL SERVER ERROR
Content-Type: application/problem+json
Content-Length: 1092
Server: Werkzeug/1.0.1 Python/3.7.0
Date: Mon, 25 May 2020 12:33:12 GMT

{"detail": "Traceback (most recent call last):\n  File \"C:\\Users\\PCDxxxx1\\programme\\py37\\lib\\site-packages\\flask\\app.py\", line 1950, in full_dispatch_request\n    rv = self.dispatch_req
uest()\n  File \"C:\\Users\\Pxxx1\\programme\\py37\\lib\\site-packages\\flask\\app.py\", line 1936, in dispatch_request\n    return self.view_functions[rule.endpoint](**req.view_args)\n  File
\"C:\\Users\\PCDTxxx1\\programme\\py37\\lib\\site-packages\\flask\\views.py\", line 89, in view\n    return self.dispatch_request(*args, **kwargs)\n  File \"C:\\Users\\PCDxxx81\\programme\\py37\
\lib\\site-packages\\flask_autocrud\\service.py\", line 45, in dispatch_request\n    return controller(*args, **kwargs)\n  File \"C:\\Users\\Pxxxx1\\programme\\py37\\lib\\site-packages\\flask_a
utocrud\\service.py\", line 161, in get\n    return self._response.build_response(builder, model.description())\nTypeError: 'InstrumentedAttribute' object is not callable\n", "instance": "about:bl
ank", "response": null, "status": 500, "title": "Internal Server Error", "type": "https://httpstatuses.com/500"}
@cs91chris
Copy link
Owner

Hi, I have checked meta api, and yes I have found a bug (It will be fixed in next release), but not with your exception, maybe it will fix even this.
Meanwhile you should check your model, because this kind of error may appear if automap_base of sqalchemy is not able to create model objects as AutoCrud expects because of missing constraints, for example: every table must have a primary key, every related tables must have a foreign key and other things like these...

@cs91chris
Copy link
Owner

Fixed with release 2.2.1

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

No branches or pull requests

2 participants