Commit 81371a01 authored by Romain Courteaud's avatar Romain Courteaud

json library is usable from python script

parent 71794155
...@@ -53,10 +53,14 @@ ...@@ -53,10 +53,14 @@
<value> <string>result_list = context.AcknowledgementTool_getUserUnreadAcknowledgementList()\n <value> <string>result_list = context.AcknowledgementTool_getUserUnreadAcknowledgementList()\n
if len(result_list):\n if len(result_list):\n
result_list = [result_list[0]]\n result_list = [result_list[0]]\n
result_list = [\'{"text_content": "%s", "acknowledge_url": "%s"}\' % (x[\'text_content\'], x[\'acknowledge_url\']) for x in result_list]\n \n
import json\n
result = {\n
"result": [{"text_content": "%s" % x[\'text_content\'], "acknowledge_url": "%s" % x[\'acknowledge_url\']} for x in result_list]\n
}\n
\n \n
context.REQUEST.RESPONSE.setHeader(\'Content-Type\', \'application/json\')\n context.REQUEST.RESPONSE.setHeader(\'Content-Type\', \'application/json\')\n
return \'{"result": [%s]}\' % \', \'.join(result_list)\n return json.dumps(result)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
424 425
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment