Skip to content

Commit

Permalink
making dpla_timeline more properly standalone and feeding two paramet…
Browse files Browse the repository at this point in the history
…ers to it from search
  • Loading branch information
thatandromeda committed Apr 5, 2012
1 parent 954df42 commit 023e138
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -16,4 +16,5 @@ Todo
+ figure out a way of dealing with annoying NPR embeds spawning iTunes a million times (suppress, replace with better multimedia, etc.)
+ get better embeds from biodiversity library
+ deal with NaN dates
+ redirect from user input page to timeline page; how does cherrypy find that page?
+ redirect from user input page to timeline page; how does cherrypy find that page?
+ allow for user input of the limit parameter
8 changes: 4 additions & 4 deletions dpla_timeline.py
@@ -1,10 +1,9 @@
#!/usr/bin/python
import urllib2
import json
import sys

def timeline(query):
limit = 20

def timeline(query, limit):
url = ''.join([
'http://api.dp.la/dev/item/?search_type=keyword',
'&query=%s' % query,
Expand All @@ -26,6 +25,7 @@ def timeline(query):
startDate = item['date']
if '>' in startDate:
startDate = "2013"

else:
startDate = ''
if 'title' in item:
Expand Down Expand Up @@ -63,4 +63,4 @@ def timeline(query):
f.close()

if __name__=="__main__":
timeline()
timeline(sys.argv[1], sys.argv[2])
Binary file removed dpla_timeline.pyc
Binary file not shown.
10 changes: 5 additions & 5 deletions dplasearch.py
Expand Up @@ -8,19 +8,19 @@ def index(self):
<head>
</head>
<body>
hello world<br /><br />yup
<form action="getParam" method="post">
<input type='text' name='param' />
Query: <input type='text' name='param' /><br /><br />
# of results: <input type='int' name='limit' size=2 /><br />
<input type='submit' value='Timeline it!' />
</form>
</body>
</html>
"""
index.exposed = True

def getParam(self, param):
timeline(param)
return True
def getParam(self, param, limit):
timeline(param, limit)
return param

getParam.exposed = True

Expand Down

0 comments on commit 023e138

Please sign in to comment.