librelist archives

« back to archive

Accessing options to be forwarded to the underlying Rule object

Accessing options to be forwarded to the underlying Rule object

From:
Abhishek Tiwari
Date:
2010-12-02 @ 01:10
Hi everyone,
I am very new to Flask and I am curious how we can access the options
passed/forwarded to the underlying Rule object.
I have rule object
def ncbiuri(keyword, **options):
"""
Search with NCBI EGQuery and return the JSON results
"""
print options  #prints blank {}
return ncbi.EGQuery(keyword, **options)
app.add_url_rule('/ncbi/<keyword>.js/', 'ncbiuri', ncbiuri)

And how you pass the options, I am trying something like this,
(/ncbi/star.js?callback=jsonp1291250671216&email=abhishek.twr%40gmail.com)

var search_term = "star";
args = {'email' : 'abhishek.twr@gmail.com'};
var urls = "http://localhost:5000/ncbi/"+search_term+".js?callback=?"

$(document).ready(function() {
$.getJSON(urls, args, function(data) {
alert('json: ' + data.eGQueryResult[0].MenuName + ' ... ' +
data.eGQueryResult[0].Count);
});
});

Is that correct way to pass the options?

Many thanks in advance

Abhishek Tiwari
                     \\|%|//
                     | ~ ~ |
                  ^( @ @ )^
-------------o000o-\_/-o000o------------------
   http://www.abhishek-tiwari.com/
------------------------------------------------------