[open-ils-commits] r1300 - servres/trunk/conifer/integration (gfawcett)

svn at svn.open-ils.org svn at svn.open-ils.org
Sat Apr 2 20:37:53 EDT 2011


Author: gfawcett
Date: 2011-04-02 20:37:52 -0400 (Sat, 02 Apr 2011)
New Revision: 1300

Modified:
   servres/trunk/conifer/integration/uwindsor.py
Log:
conifer/integration/uwindsor.py: brought a few more things back from local_settings

Have faith, I have a plan here, the result will be good.

Modified: servres/trunk/conifer/integration/uwindsor.py
===================================================================
--- servres/trunk/conifer/integration/uwindsor.py	2011-04-03 00:37:49 UTC (rev 1299)
+++ servres/trunk/conifer/integration/uwindsor.py	2011-04-03 00:37:52 UTC (rev 1300)
@@ -37,7 +37,14 @@
 OPENSRF_FLESHED2_CALL     = "open-ils.search.asset.copy.fleshed2.retrieve"
 OPENSRF_FLESHEDCOPY_CALL  = "open-ils.search.asset.copy.fleshed.batch.retrieve.authoritative"
 
+TIME_FORMAT = "%Y-%m-%dT%H:%M:%S"
+DUE_FORMAT  = "%b %d %Y, %r"
 
+# regular expression to detect DVD, CD, CD-ROM, Guide, Booklet on the end of a
+# call number
+IS_ATTACHMENT = re.compile('\w*DVD\s?|\w*CD\s?|\w[Gg]uide\s?|\w[Bb]ooklet\s?|\w*CD\-ROM\s?')
+
+
 def department_course_catalogue():
     """
     Return a list of rows representing all known, active courses and
@@ -130,7 +137,7 @@
             voltest = re.search(r'\w*v\.\s?(\d+)', callnum)
 
             # attachment test
-            attachtest = re.search(settings.ATTACHMENT, callnum)
+            attachtest = re.search(IS_ATTACHMENT, callnum)
 
             if loc == settings.RESERVES_DESK_NAME:
                 desk += anystatus_here
@@ -178,7 +185,7 @@
                             rawdate = circ.get("due_date")
                             #remove offset info, %z is flakey for some reason
                             rawdate = rawdate[:-5]
-                            duetime = time.strptime(rawdate, settings.TIME_FORMAT)
+                            duetime = time.strptime(rawdate, TIME_FORMAT)
 
                         if (avail == 0 or bringfw) and circs and len(circs) > 0:
                             if len(dueinfo) == 0 or bringfw:
@@ -187,16 +194,16 @@
                                     if (int(voltest.group(1)) > vol):
                                         if len(dueinfo) > 0:
                                             dueinfo = dueinfo + "/"
-                                        dueinfo = dueinfo + voltest.group(0) + ': ' + time.strftime(settings.DUE_FORMAT,earliestdue)
+                                        dueinfo = dueinfo + voltest.group(0) + ': ' + time.strftime(DUE_FORMAT,earliestdue)
                                     else:
                                         tmpinfo = dueinfo
-                                        dueinfo = voltest.group(0) + ': ' + time.strftime(settings.DUE_FORMAT,earliestdue)
+                                        dueinfo = voltest.group(0) + ': ' + time.strftime(DUE_FORMAT,earliestdue)
                                         if len(tmpinfo) > 0:
                                             dueinfo = dueinfo + "/" + tmpinfo
                                     callprefix = callsuffix = ''
                                 elif attachtest:
                                     tmpinfo = dueinfo
-                                    dueinfo = attachtest.group(0) + ': ' + time.strftime(settings.DUE_FORMAT,earliestdue)
+                                    dueinfo = attachtest.group(0) + ': ' + time.strftime(DUE_FORMAT,earliestdue)
                                     if len(callno) > 0:
                                         callno = callno + '/' + callnum
                                         callprefix = callsuffix = ''
@@ -206,19 +213,19 @@
                                         dueinfo = dueinfo + "/" + tmpinfo
 
                                 if not bringfw:
-                                    dueinfo = time.strftime(settings.DUE_FORMAT,earliestdue)
+                                    dueinfo = time.strftime(DUE_FORMAT,earliestdue)
                                     callno = callnum
 
                             # way too wacky to sort out vols for this
                             if duetime < earliestdue and not bringfw:
                                 earliestdue = duetime
-                                dueinfo = time.strftime(settings.DUE_FORMAT,earliestdue)
+                                dueinfo = time.strftime(DUE_FORMAT,earliestdue)
                                 callno = callnum
 
                         alldisplay = callnum + ' (Available)'
 
                         if circs and isinstance(circs, list):
-                            alldisplay = '%s (DUE: %s)' % (callnum, time.strftime(settings.DUE_FORMAT,duetime))
+                            alldisplay = '%s (DUE: %s)' % (callnum, time.strftime(DUE_FORMAT,duetime))
 
                         alldues.append(alldisplay)
 



More information about the open-ils-commits mailing list