From 5c5d01a9b21e182ca7e61d157f6c03b91953e503 Mon Sep 17 00:00:00 2001 From: Arvind Date: Wed, 27 Mar 2013 17:11:06 +0530 Subject: [PATCH] Fixing fetch.py - Added missing import and a return statement --- fetch.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fetch.py b/fetch.py index b22b5f8..26b6518 100644 --- a/fetch.py +++ b/fetch.py @@ -6,7 +6,7 @@ from flask import jsonify import logging from logging import FileHandler import pymongo - +import os app = Flask(__name__) @@ -24,11 +24,14 @@ def fetch(): collection = db['data'] ret = {} x = 0 - for i in collection.find({'url':request.args['url']}): + resource = "default" + if request.args.has_key('res'): + resource = request.args['res'] + for i in collection.find({'res':resource}): del(i['_id']) ret[x] = i x = x + 1 - jsonify(ret) + return jsonify(ret) #Log the errors, don't depend on apache to log it for you. -- 1.7.10.4