From 9bf9041d1f7e4ed69c64d02194e570127328d6a8 Mon Sep 17 00:00:00 2001 From: gfawcett Date: Mon, 23 Mar 2009 01:06:10 +0000 Subject: [PATCH] added search-form (@prefix-style query) to /syrup/graham_z3950_test/ git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@211 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- conifer/syrup/views.py | 8 +++++--- conifer/templates/graham_z3950_test.xhtml | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/conifer/syrup/views.py b/conifer/syrup/views.py index 196653e..578ba63 100644 --- a/conifer/syrup/views.py +++ b/conifer/syrup/views.py @@ -244,18 +244,20 @@ def z3950_test(request): return g.render('z3950_test.xhtml', res_str=res_str) def graham_z3950_test(request): + query = request.GET.get('query', '@and "Denis" "Gravel"') from conifer.libsystems.z3950 import yaz_search from conifer.libsystems.evergreen.item_status import lookup_availability - host, db, query = ('dwarf.cs.uoguelph.ca:2210', 'conifer', '@and "Denis" "Gravel"') + host, db, query = ('dwarf.cs.uoguelph.ca:2210', 'conifer', query) #host, db, query = ('z3950.loc.gov:7090', 'VOYAGER', '@attr 1=4 @attr 4=1 "dylan"') results = yaz_search.search(host, db, query) for result in results: bibid = result.get('901c') if bibid: - avail = lookup_availability(bibid) + # it would be better to do these asynchronously. + avail = lookup_availability(bibid) if avail: result['avail'] = avail - return g.render('graham_z3950_test.xhtml', results=results) + return g.render('graham_z3950_test.xhtml', results=results, query=query) def browse(request, browse_option=''): #the defaults should be moved into a config file or something... diff --git a/conifer/templates/graham_z3950_test.xhtml b/conifer/templates/graham_z3950_test.xhtml index 5dfd989..0ba131f 100644 --- a/conifer/templates/graham_z3950_test.xhtml +++ b/conifer/templates/graham_z3950_test.xhtml @@ -21,6 +21,10 @@ keys = [('245a', 'Title'), ('100a', 'Author'), ('260c', 'PubDate'), ('901c', 'Bi

${title}

+
+ + +

show more detail