No entry in the database... I could execute the post from postman... but if I try from axios in vue I am even getting a web2py server error:
ERROR:Rocket.Errors.Thread-2:Traceback (most recent call last): > File > "/Users/titogarridoogando/Documents/Projetos/web2py/controle/web2py/gluon/rocket.py", > line 1797, in run_app > sections = len(output) > TypeError: object of type 'Reference' has no len() > > During handling of the above exception, another exception occurred: > > Traceback (most recent call last): > File > "/Users/titogarridoogando/Documents/Projetos/web2py/controle/web2py/gluon/rocket.py", > line 1288, in run > self.run_app(conn) > File > "/Users/titogarridoogando/Documents/Projetos/web2py/controle/web2py/gluon/rocket.py", > line 1819, in run_app > output.close() > TypeError: 'NoneType' object is not callable No idea what it means... On Wed, Jul 17, 2019 at 2:23 PM Dave S <[email protected]> wrote: > > > On Wednesday, July 17, 2019 at 7:36:40 AM UTC-7, Tito Garrido wrote: >> >> Hi! >> >> I am trying to call a POST method from a Vue.js frontend. My backend is >> web2py serving a REST API: >> [...] >> > This is the Data sent: >> >>> {'parent_transaction': None, 'transaction_date': '01/01/2019', >>> 'transaction_label': 'label', 'transaction_type': 'Receita', 'treatment': >>> 1, 'transaction_value': 250, 'paid': False, 'payment_method': None} >>> >> >> This is the response: >> >> >>> 1. config: {url: " >>> http://127.0.0.1:8000/controle7030/product/save_transaction", method >>> : "post", data: >>> >>> "{"total_value":250,"costs":[[{"id":1,"product":1,"…85","total_cost":66,"transaction_type":"Receita"}" >>> , headers: {…}, transformRequest: Array(1), …} >>> 2. data: "iderrors" >>> 3. headers: {pragma: "no-cache", content-type: "text/html; >>> charset=utf-8", cache-control: "no-store, no-cache, must-revalidate, >>> post-check=0, pre-check=0", expires: "Wed, 17 Jul 2019 14:35:41 GMT"} >>> 4. request: XMLHttpRequest {onreadystatechange: ƒ, readyState: 4, >>> timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, …} >>> 5. status: 200 >>> 6. statusText: "OK" >>> 7. __proto__: Object >>> >>> >> Any idea what is wrong? What does mean "iderrors"? >> > > Does that transaction get entered into the database? > > The one thought I have about "iderrors" is that you have a mishmash > occurring in converting the result into JSON. > > I'd expect the body of the response to look something like > {"id": 2345, "errors": None} > > where 2345 is the value returned by validate_and_insert() [the id field of > the new row in the table] and None to indicate no errors. > > /dps > > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/daa835f7-e232-494c-9bbc-def2a249869f%40googlegroups.com > <https://groups.google.com/d/msgid/web2py/daa835f7-e232-494c-9bbc-def2a249869f%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Linux User #387870 .........____ .... _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:_______ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CAL67CHE3fpSVeW0cjGB2s1beYf0nAEhYivuqNwdXVN6ss_X%3DdA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

