Return-Path: X-Original-To: apmail-climate-commits-archive@minotaur.apache.org Delivered-To: apmail-climate-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DC71E1098D for ; Tue, 18 Jun 2013 16:38:38 +0000 (UTC) Received: (qmail 52889 invoked by uid 500); 18 Jun 2013 16:38:38 -0000 Delivered-To: apmail-climate-commits-archive@climate.apache.org Received: (qmail 52801 invoked by uid 500); 18 Jun 2013 16:38:36 -0000 Mailing-List: contact commits-help@climate.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@climate.incubator.apache.org Delivered-To: mailing list commits@climate.incubator.apache.org Received: (qmail 52780 invoked by uid 99); 18 Jun 2013 16:38:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jun 2013 16:38:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jun 2013 16:38:34 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E260023889F1; Tue, 18 Jun 2013 16:38:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1494190 - /incubator/climate/trunk/rcmet/src/main/python/rcmes/services/run_rcmes_processing.py Date: Tue, 18 Jun 2013 16:38:14 -0000 To: commits@climate.incubator.apache.org From: joyce@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130618163814.E260023889F1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: joyce Date: Tue Jun 18 16:38:14 2013 New Revision: 1494190 URL: http://svn.apache.org/r1494190 Log: CLIMATE-120 resolved - Make run/rcmes endpoing JSONP compatible - Switch all parameter checks to be GET compatible instead of POST compatible. - Add JSONP compatible response check. Modified: incubator/climate/trunk/rcmet/src/main/python/rcmes/services/run_rcmes_processing.py Modified: incubator/climate/trunk/rcmet/src/main/python/rcmes/services/run_rcmes_processing.py URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/python/rcmes/services/run_rcmes_processing.py?rev=1494190&r1=1494189&r2=1494190&view=diff ============================================================================== --- incubator/climate/trunk/rcmet/src/main/python/rcmes/services/run_rcmes_processing.py (original) +++ incubator/climate/trunk/rcmet/src/main/python/rcmes/services/run_rcmes_processing.py Tue Jun 18 16:38:14 2013 @@ -43,7 +43,7 @@ titleOption = 'default' #this means th plotFileNameOption = 'default' #another good option we can use. ########################################################### -@route('/rcmes/run/', method='POST') +@route('/rcmes/run/') def rcmes_go(): print "**********\nBEGIN RCMES2.0_RUN\n**********" print 'cachedir', cachedir @@ -56,50 +56,50 @@ def rcmes_go(): print "I/O error({0}: {1}".format(e.errno, e.strerror) sys.exit(1) - obsDatasetId = int(request.POST.get('obsDatasetId', '').strip()) + obsDatasetId = int(request.query.get('obsDatasetId', '').strip()) print 'obsDatasetId', obsDatasetId - obsParameterId = int(request.POST.get('obsParameterId', '').strip()) + obsParameterId = int(request.query.get('obsParameterId', '').strip()) print 'obsParameterId', obsParameterId #reformat DateTime after pulling it out of the POST - POSTstartTime = str(request.POST.get('startTime', '').strip()) + POSTstartTime = str(request.query.get('startTime', '').strip()) startTime = datetime.datetime.fromtimestamp(time.mktime(time.strptime(POSTstartTime, time_format_new))) print 'startTime', startTime #reformat DateTime after pulling it out of the POST - POSTendTime = str(request.POST.get('endTime', '').strip()) + POSTendTime = str(request.query.get('endTime', '').strip()) endTime = datetime.datetime.fromtimestamp(time.mktime(time.strptime(POSTendTime, time_format_new))) print 'endTime', endTime - latMin = float(request.POST.get('latMin', '').strip()) + latMin = float(request.query.get('latMin', '').strip()) print 'latMin', latMin - latMax = float(request.POST.get('latMax', '').strip()) + latMax = float(request.query.get('latMax', '').strip()) print 'latMax', latMax - lonMin = float(request.POST.get('lonMin', '').strip()) + lonMin = float(request.query.get('lonMin', '').strip()) print 'lonMin', lonMin - lonMax = float(request.POST.get('lonMax', '').strip()) + lonMax = float(request.query.get('lonMax', '').strip()) print 'lonMax', lonMax - filelist = [request.POST.get('filelist', '').strip()] + filelist = [request.query.get('filelist', '').strip()] print 'filelist', filelist[0] - modelVarName = str(request.POST.get('modelVarName', '').strip()) + modelVarName = str(request.query.get('modelVarName', '').strip()) print 'modelVarName', modelVarName - precipFlag = request.POST.get('precipFlag', '').strip() + precipFlag = request.query.get('precipFlag', '').strip() print 'precipFlag', precipFlag - modelTimeVarName = str(request.POST.get('modelTimeVarName', '').strip()) + modelTimeVarName = str(request.query.get('modelTimeVarName', '').strip()) print 'modelTimeVarName', modelTimeVarName - modelLatVarName = str(request.POST.get('modelLatVarName', '').strip()) + modelLatVarName = str(request.query.get('modelLatVarName', '').strip()) print 'modelLatVarName', modelLatVarName - modelLonVarName = str(request.POST.get('modelLonVarName', '').strip()) + modelLonVarName = str(request.query.get('modelLonVarName', '').strip()) print 'modelLonVarName', modelLonVarName - regridOption = str(request.POST.get('regridOption', '').strip()) + regridOption = str(request.query.get('regridOption', '').strip()) print 'regridOption', regridOption - timeRegridOption = str(request.POST.get('timeRegridOption', '').strip()) + timeRegridOption = str(request.query.get('timeRegridOption', '').strip()) print 'timeRegridOption', timeRegridOption - seasonalCycleOption = request.POST.get('seasonalCycleOption', '').strip() + seasonalCycleOption = request.query.get('seasonalCycleOption', '').strip() print 'seasonalCycleOption', seasonalCycleOption - metricOption = str(request.POST.get('metricOption', '').strip()) + metricOption = str(request.query.get('metricOption', '').strip()) print 'metricOption', metricOption settings = {"cacheDir": cachedir, "workDir": workdir, "fileList": filelist} @@ -127,4 +127,7 @@ def rcmes_go(): #Extra Code in case bottle has an issue with my Dictionary #json_output = json.dumps(product_dict, sort_keys=True, indent=4) - return product_dict + if (request.query.callback): + return"%s(%s)" % (request.query.callback, product_dict) + else: + return product_dict