Browse files

#17 fix /identify routing and use data obtained through GET properly …

…- still bugs with the routing if you try to do a DOI that way!
  • Loading branch information...
1 parent 8ae4b78 commit ea82aed0df848aca5dc73514ac75bb4135969c0d @emanuil-tolev emanuil-tolev committed Feb 25, 2012
Showing with 12 additions and 7 deletions.
  1. +12 −7 idfind/web.py
View
19 idfind/web.py
@@ -131,15 +131,20 @@ def description(did=None):
io = idfind.iomanager.IOManager(res)
return render_template('description.html', io=io)
-
@app.route('/identify', methods=['GET','POST'])
-@app.route('/identify<therest>', methods=['GET','POST'])
+@app.route('/identify/<therest>', methods=['GET','POST'])
def identify(therest=''):
JSON = False
- if therest.endswith(".json") or request.values.get('format',"") == "json":
- JSON = True
-
- q = request.values.get('q','').strip('"')
+
+ if therest:
+ q = therest
+ else:
+ q = request.values.get('q','').strip('"')
+
+ if q.endswith(".json") or request.values.get('format',"") == "json":
+ JSON = True
+ q = q.rstrip('.json')
+
if q:
# check the storage of identifiers, if already there, respond. else find it.
identifier = idfind.dao.Identifier.query(q=q)
@@ -163,7 +168,7 @@ def identify(therest=''):
return outputJSON(results=answer)
else:
return render_template('answer.html',answer=answer,string=q)
-
+
return render_template('identify.html')

0 comments on commit ea82aed

Please sign in to comment.