On Friday, July 26, 2013 12:45:58 AM UTC+8, Ray (a.k.a. Iceberg) wrote:
>
>
>
> On Tuesday, June 11, 2013 5:14:42 AM UTC+8, Niphlod wrote:
>>
>> ps: recent web2py releases should parse application/json POSTs
>> transparently, no need to request.body.read() anymore it goes all in
>> request.
On Tuesday, June 11, 2013 5:14:42 AM UTC+8, Niphlod wrote:
>
> ps: recent web2py releases should parse application/json POSTs
> transparently, no need to request.body.read() anymore it goes all in
> request.vars and request.post_vars as usual.
>
>
Sorry to chime in an old thread, but which
welll... this should work:
db.someTable.insert(**data)
but insert returns a number (actually a Reference object) and therefore you
cannot pass it to a dict as in:
dict(db.someTable.insert(**data))
Insert and validate returns a dict instead (containing the id and errors)
On Monday, 10 Ju
Thanks so much. This works for
dict(db.someTable.validate_and_insert(**data))
but for some reason not for
dict(db.someTable.insert(**data))
That's fine for me, I'm just wondering though.
Btw: What exactly does ** do in this case?
Thanks again and regards,
Philipp
Am Montag, 10. Juni 2013 23:
ps: recent web2py releases should parse application/json POSTs
transparently, no need to request.body.read() anymore it goes all in
request.vars and request.post_vars as usual.
On Monday, June 10, 2013 11:02:36 PM UTC+2, Massimo Di Pierro wrote:
>
> return dict(db.someDatabase.insert(**data)
return dict(db.someDatabase.insert(**data))
#or
return dict(db.someDatabase.validate_and_insert(**data))
On Monday, 10 June 2013 15:58:16 UTC-5, Philipp Müller wrote:
>
> So far, this seems to work fine. I struggle though when trying to write
> this data in my database.
>
> I tried doing:
> data
So far, this seems to work fine. I struggle though when trying to write
this data in my database.
I tried doing:
data = sj.loads(request.body.read())
#and later
return dict(db.someDatabase.insert(data))
#or
return dict(db.someDatabase.validate_and_insert(data))
for all of which I got the error m
For future users reading this thread... this means that the Iphone sent the
JSON object POSTing to the page directly in the data stream, without "the
usual" form encoding. For that, you can access what has been posted "in raw
format" with request.body.read().
PS: Keep the code small
import glu
import gluon.contrib.simplejson
data = gluon.contrib.simplejson.loads(request.body.read())
That was the trick
Thank You Niphlod, You put me in the right direction.
IOS + WEB2PY = beautiful combination!!
Mchurch
Il giorno mercoledì 24 ottobre 2012 09:01:40 UTC+2, Mchurch ha scritto:
>
> Hi
Hi Niphlod, did You hope to be free of me so soon? :)
Looking at web2py errors, if i make a post request values are empty (not if
i make a GET, but the final result is the same).
Using "CHARLES, web debugging proxy" i can see that data are dispatched
with correct values and correct Content-Type (
almost dinner time here :P
On Tuesday, October 23, 2012 5:44:45 PM UTC+2, Mchurch wrote:
>
> I'll try, thanks.
> Ps. Did You eat some snakes for breakfast?
> :)
--
I'll try, thanks.
Ps. Did You eat some snakes for breakfast?
:)
--
if you PRINT *something*, you don't return *something* to the device, but
you can see the *something* on the console, .i.e. the shell where you
started web2py.py . I'm guessing that at least you have access to your
developing environment :P !
On Tuesday, October 23, 2012 3:38:26 PM UTC+2, Mchur
but i don't open that page in a browser, i'm just sending data.
Should I use a console error like firebug may be?
Sorry for the stupid question, but if i open the page in a browser without
the data from ios i get from web2py "Expected string o JSON...".
I'm lost somewhere between IOs and web2py!
What I said was that if you print on the server-side you can see what
happens on the "endpoint" you have control of: not IOS, the webserver!
On Tuesday, October 23, 2012 3:27:46 PM UTC+2, Mchurch wrote:
>
> from the app, no more errors, always that "500".
>
>> try to print out request.vars and re
from the app, no more errors, always that "500".
> try to print out request.vars and request.vars.body.read() and see their
> contents.
>
I have to think and study more about that; it's a json call, i can't reach
directly that page, i should give the server response back to the app to
check w
that's the problem when you don't know what something does.
try to print out request.vars and request.vars.body() and see their
contents.
PS: you can also watch the errors for the app to investigate the issue (if
your phone is getting a 500, it's probable that the error is logged in
web2p
I followed instructons,
> If you're using AFHTTPClient, set the parameterEncoding property to
> AFJSONParameterEncoding. Any method on that HTTP client with aparameters
> argument
> will now encode the passed object into a JSON string and set the HTTP body
> and Content-Type header appropriate
in what format are you posting json back to the server (not the format of
the json, that is of course json ... just the way you use to transmit data)
? are you using application/x-www-form-urlencoded ? multipart/form-data ?
binary post ?
On Tuesday, October 23, 2012 10:23:16 AM UTC+2, Mchurch w
19 matches
Mail list logo