Skip to content

Commit

Permalink
Merge pull request #94 from boyska/93-agherant-self
Browse files Browse the repository at this point in the history
SELF is pointless on agherant_standalong; fix #93
  • Loading branch information
ael-code committed Feb 13, 2015
2 parents b39b0e4 + fa4f47a commit bd05798
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions webant/agherant.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from flask import Blueprint, render_template, abort, request, Response, \
current_app, url_for
from werkzeug.routing import BuildError
import opensearch

from utils import memoize, requestedFormat
Expand Down Expand Up @@ -35,9 +36,15 @@ def search():
def aggregate(descriptions, query):
def autoreplace(description_url):
if description_url == 'SELF':
return url_for('description', _external=True)
try:
return url_for('description', _external=True)
except BuildError:
log.info('SELF is not a valid opensearch description if '
'you are not running webant')
return None
return description_url
descriptions = map(autoreplace, descriptions)
descriptions = filter(lambda x: x is not None,
map(autoreplace, descriptions))
clients = []
for url in descriptions:
log.debug("Fetching description %s")
Expand Down

0 comments on commit bd05798

Please sign in to comment.