From: artunit Date: Mon, 9 Mar 2009 23:13:55 +0000 (+0000) Subject: git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@158 6d9bc8c9-1ec2-4278... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ac9065de01950bc5c4adbf7ecb9f23789f29d2e8;p=Syrup.git git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@158 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- diff --git a/conifer/syrup/urls.py b/conifer/syrup/urls.py index 433502c..b9c24a8 100644 --- a/conifer/syrup/urls.py +++ b/conifer/syrup/urls.py @@ -15,6 +15,7 @@ urlpatterns = patterns('conifer.syrup.views', (r'^browse/$', 'browse_courses'), (r'^browse/(?P.*)/$', 'browse_courses'), (r'^prefs/$', 'user_prefs'), + (r'^z3950test/$', 'z3950_test'), (r'^opencourse/$', 'open_courses'), (r'^search/$', 'search'), (r'^instructors/$', 'instructors'), diff --git a/conifer/syrup/views.py b/conifer/syrup/views.py index ecd2f9b..fb9bd13 100644 --- a/conifer/syrup/views.py +++ b/conifer/syrup/views.py @@ -16,6 +16,10 @@ from gettext import gettext as _ # fixme, is this the right function to import? from django.utils import simplejson import sys +# for Z39.50 support, not sure whether this is the way to go yet but +# as generic as it gets +# from PyZ3950 import zoom + #------------------------------------------------------------ # Authentication @@ -99,6 +103,23 @@ def user_prefs(request): title=_('Sorry...'), content=_('The Preferences page isn\'t ready yet.')) +def z3950_test(request): + conn = zoom.Connection ('z3950.loc.gov', 7090) + conn.databaseName = 'VOYAGER' + conn.preferredRecordSyntax = 'USMARC' + query = zoom.Query ('CCL', 'ti="1066 and all that"') + # print("connecting...") + res = conn.search (query) + collector = [] + for r in res: + collector.append(str(r)) + conn.close () + # print("done searching...") + res_str = "" . join(collector) + # print(res_str) + + return g.render('z3950_test.xhtml', res_str=res_str) + def browse_courses(request, browse_option=''): #the defaults should be moved into a config file or something... page_num = int(request.GET.get('page', 1)) diff --git a/conifer/templates/z3950_test.xhtml b/conifer/templates/z3950_test.xhtml new file mode 100644 index 0000000..f0b4504 --- /dev/null +++ b/conifer/templates/z3950_test.xhtml @@ -0,0 +1,24 @@ + + + + + + ${title} + + + +

${title}

+ +
+    ${results}
+    
+ +