<div id="MainArea">
<p align="center">MY SEARCH ENGINE</p>
<form name="form1" method="get" action="results.html">
<label for="SearchBar"></label>
<div align="center">
<input name="query" type="text" id="SearchBar" value="" size = "100px"><br />
<input name="submit" type="submit" value="Search">
</div>
</form>
<p align="center"> </p>
</div>{{extend 'layout.html'}}
<h1>This is the default/results.html template</h1>
{{=BEAUTIFY(response._vars)}}
<div>{{=results}}</div>import urllib2
def index():
return dict()
def results():
address = "http://www.blekko.com/?q=%(query)s+/json&auth=<mykey>" % dict(query=request.vars.query)
response = urllib2.urlopen(address)
html=response.read()
return html
index.html:
<div id="MainArea">
<p align="center">MY SEARCH ENGINE</p>
<form name="form1" method="get" action="{{=URL('results')}}">
<label for="SearchBar"></label>
<div align="center">
<input name="query" type="text" id="SearchBar" value="" size = "100px"><br />
<input name="submit" type="submit" value="Search">
</div>
</form>
<p align="center"> </p>
</div>
results.html{{extend 'layout.html'}}
<h1>This is the default/results.html template</h1>
{{=BEAUTIFY(response._vars)}}
<div>{{=results}}</div>default.py:
import urllib
def index():
return dict()
def results():
address = "http://www.blekko.com/?q=%(query)s+/json&auth=<mykey>" % dict(query=request.vars.query)
results = urllib.urlopen(address).read()
return dict(results=results)
Thanks for that but it doesn't really answer my question. When I return dict(results=results), I want to pass that to a script, lets say 'process.py' to tokenize it etc. My question is: Do I create a new controller called process.py (which won't have a corresponding HTML page), or do I create a model? My app doesn't have a database, it doesn't need one. I am dealing with one user input term that returns 3 sets of json data which will be parsed and output directly. It doesn't need to be stored. Can you give me any info regarding that. I'm just not sure where I should be creating my .py files to do the processing.