[open-ils-commits] r158 - in servres/trunk/conifer: syrup templates (artunit)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Mar 9 19:13:55 EDT 2009


Author: artunit
Date: 2009-03-09 19:13:55 -0400 (Mon, 09 Mar 2009)
New Revision: 158

Added:
   servres/trunk/conifer/templates/z3950_test.xhtml
Modified:
   servres/trunk/conifer/syrup/urls.py
   servres/trunk/conifer/syrup/views.py
Log:


Modified: servres/trunk/conifer/syrup/urls.py
===================================================================
--- servres/trunk/conifer/syrup/urls.py	2009-03-09 02:05:26 UTC (rev 157)
+++ servres/trunk/conifer/syrup/urls.py	2009-03-09 23:13:55 UTC (rev 158)
@@ -15,6 +15,7 @@
     (r'^browse/$', 'browse_courses'),
     (r'^browse/(?P<browse_option>.*)/$', 'browse_courses'),
     (r'^prefs/$', 'user_prefs'),
+    (r'^z3950test/$', 'z3950_test'),
     (r'^opencourse/$', 'open_courses'),
     (r'^search/$', 'search'),
     (r'^instructors/$', 'instructors'),

Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py	2009-03-09 02:05:26 UTC (rev 157)
+++ servres/trunk/conifer/syrup/views.py	2009-03-09 23:13:55 UTC (rev 158)
@@ -16,6 +16,10 @@
 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 @@
                     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))

Added: servres/trunk/conifer/templates/z3950_test.xhtml
===================================================================
--- servres/trunk/conifer/templates/z3950_test.xhtml	                        (rev 0)
+++ servres/trunk/conifer/templates/z3950_test.xhtml	2009-03-09 23:13:55 UTC (rev 158)
@@ -0,0 +1,24 @@
+<?python
+title = _('Z39.50 Test')
+results = res_str
+?>
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:xi="http://www.w3.org/2001/XInclude"
+      xmlns:py="http://genshi.edgewall.org/">
+<xi:include href="master.xhtml"/>
+<xi:include href="paginate.xhtml"/>
+<head>
+  <title>${title}</title>
+  <script type="text/javascript">
+    <!-- !This ought to be in paginate.xhtml, not here. how to do? -->
+    $(function() { $('.pagetable').tablesorter(); });
+  </script>
+</head>
+<body>
+    <h1>${title}</h1>
+
+    <pre>
+    ${results}
+    </pre>
+</body>
+</html>



More information about the open-ils-commits mailing list