5c78a27 by Arvind at 2012-06-17 | 1 | import json |
2 | import pymongo |
|
3 | #from bson.code import * |
|
4 | #from urllib import unquote_plus |
|
5 | def application(environ, start_response): |
|
6 | status = '200 OK' |
|
7 | response_headers = [('Content-type', 'application/json'),('Access-Control-Allow-Origin', '*')] |
|
8 | start_response(status, response_headers) |
|
9 | c = pymongo.Connection() |
|
10 | db = c['mural'] |
|
11 | coll = db['data'] |
|
12 | ret = {} |
|
13 | x = 0 |
|
14 | for i in coll.find(): |
|
15 | del(i['_id']) |
|
16 | ret[x] = i |
|
17 | x = x + 1 |
|
18 | #return repr(recieved) |
|
19 | return json.dumps(ret) |