Closed GoogleCodeExporter closed 9 years ago
Original comment by ahunter.ccg@gmail.com
on 7 Jul 2011 at 7:09
Original comment by aahun...@gmail.com
on 29 Jul 2011 at 3:33
Original comment by retrogra...@gmail.com
on 2 Aug 2011 at 8:09
the parameter in the json for 'encrypt_on_login' and 'encypted' is 'f', and 'f'
is a string not a boolean. All strings of non-zero length evaluate to be true,
thus the encrypt flags are set to be true.
JSON supports booleans.
http://en.wikipedia.org/wiki/JSON#Data_types.2C_syntax_and_example
so if instead of sending the final encoding something like '.. "encrypted": "f"
', you need to send '... "encrypted": false '
I can't see whats happening inside perl function creatObject(), but that will
need to output the correct JSON data type.
As an example, the following works:
{{{
curl -k -b cookie.txt -H "Content-Type: application/json; charset=UTF-8" -H
"X-Requested-With: XMLHttpRequest" --data-binary '{"data": {"username":
"bioflow", "last_modified_by": 1, "description": "dummy credential",
"encrypted": false, "created_by": 1, "user": 1, "encrypt_on_login": false}}'
https://faramir.localdomain/yabiadmin/cwellington/admin/yabi/credential/ext/json
{"message": "Created new record.", "data": {"username": "bioflow",
"encrypt_on_login": "False", "description": "dummy credential", "encrypted":
"False", "cert": "", "created_by": 1, "expires_on": "None", "created_on":
"2011-08-03 11:54:51.136011", "backends": [], "last_modified_by": 1, "key": "",
"user__unicode": "andrew", "last_modified_by__unicode": "django", "password":
"", "created_by__unicode": "django", "id": "67", "last_modified_on":
"2011-08-03 11:54:51.135955", "user": 1}, "success": true}
}}}
Notice the *returned* json has the wrong json data type in the fields ("False",
rather than false). This is a bug in this json admin extension in Mango.
Although the returned snippet is wrong, the correct data types are stored, and
also returned if asked for but not through ext/json. The bug is in the
serialise_record() method in django/contrib/webservices/ext.py and will be
addressed in a later release.
Original comment by retrogra...@gmail.com
on 3 Aug 2011 at 3:59
Alerting sysadmins
Original comment by amacgregor
on 11 Aug 2011 at 3:17
Original issue reported on code.google.com by
ahunter.ccg@gmail.com
on 7 Jul 2011 at 1:24