[library-web] add fallback from API search to Google
- From: Frederic Peters <fpeters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [library-web] add fallback from API search to Google
- Date: Sat, 4 Dec 2010 18:11:05 +0000 (UTC)
commit 1101daee61bf37dfcfade88e495bee6bceb7391f
Author: Frédéric Péters <fpeters 0d be>
Date: Sat Dec 4 19:09:54 2010 +0100
add fallback from API search to Google
web/api.py | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/web/api.py b/web/api.py
index 84a2a4b..9f0b42b 100644
--- a/web/api.py
+++ b/web/api.py
@@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
+import urllib
import os
import sys
from pysqlite2 import dbapi2 as sqlite
@@ -57,4 +58,9 @@ def redirect(request):
if path:
path = path[0]
return HttpResponseRedirect(path)
- return HttpResponse('Not found')
+ # fallback to a Google search
+ return HttpResponseRedirect(
+ 'http://www.google.com/custom?'\
+ 'domains=library.gnome.org&'\
+ 'sitesearch=library.gnome.org&'\
+ 'q=%s' % urllib.quote(symbol))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]