(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'),
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
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))
--- /dev/null
+<?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>