[open-ils-commits] r1118 - in servres/trunk/conifer: integration syrup (gfawcett)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Dec 27 16:58:07 EST 2010


Author: gfawcett
Date: 2010-12-27 16:58:01 -0500 (Mon, 27 Dec 2010)
New Revision: 1118

Modified:
   servres/trunk/conifer/integration/uwindsor.py
   servres/trunk/conifer/syrup/models.py
Log:
uwindsor: fetch catalogue of known courses, departments.

Modified: servres/trunk/conifer/integration/uwindsor.py
===================================================================
--- servres/trunk/conifer/integration/uwindsor.py	2010-12-23 18:04:15 UTC (rev 1117)
+++ servres/trunk/conifer/integration/uwindsor.py	2010-12-27 21:58:01 UTC (rev 1118)
@@ -11,6 +11,8 @@
 import re
 import uwindsor_campus_info
 from memoization import memoize
+import csv
+import subprocess
 
 # USE_Z3950: if True, use Z39.50 for catalogue search; if False, use OpenSRF.
 # Don't set this value directly here: rather, if there is a valid Z3950_CONFIG
@@ -25,16 +27,13 @@
     the departments to which they belong. Each row should be a tuple
     in the form: ('Department name', 'course-code', 'Course name').
     """
-    return [
-        ('Arts','01-01-209','Ethics in the Professions'),
-        ('Social Work','02-47-204','Issues & Perspectives in Social Welfare'),
-        ('Social Work','02-47-211','Prof Comm in Gen. Social Work Practice'),
-        ('Social Work','02-47-336','Theory and Practice Social Work I'),
-        ('Social Work','02-47-361','Field Practice I - A'),
-        ('Social Work','02-47-362','Field Practice I - B'),
-        ('Social Work','02-47-370','Mothering and Motherhood'),
-        ('Social Work','02-47-456','Social Work and Health'),
-        ]
+    url = 'http://cleo.uwindsor.ca/graham/courses.txt.gz'
+    p = subprocess.Popen('curl -s %s | gunzip -c' % url, 
+                         shell=True, stdout=subprocess.PIPE)
+    reader = csv.reader(p.stdout)
+    catalogue = list(reader)
+    p.stdout.close()
+    return catalogue
 
 def term_catalogue():
     """

Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py	2010-12-23 18:04:15 UTC (rev 1117)
+++ servres/trunk/conifer/syrup/models.py	2010-12-27 21:58:01 UTC (rev 1118)
@@ -750,8 +750,9 @@
     else:
         return highlight_re.sub(highlighter, text)
 
+#----------------------------------------------------------------------
+# Activate the local integration module.
 
-
 if hasattr(settings, 'INTEGRATION_MODULE'):
     import conifer.syrup.integration
     hooks = __import__(settings.INTEGRATION_MODULE, fromlist=[''])



More information about the open-ils-commits mailing list