[open-ils-commits] r922 - in servres/trunk/conifer: . integration libsystems libsystems/z3950 syrup syrup/views templates templates/auth templates/generic templates/item templates/phys (gfawcett)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jul 14 20:55:58 EDT 2010


Author: gfawcett
Date: 2010-07-14 20:55:56 -0400 (Wed, 14 Jul 2010)
New Revision: 922

Added:
   servres/trunk/conifer/libsystems/marcxml.py
Removed:
   servres/trunk/conifer/libsystems/z3950/marcxml.py
Modified:
   servres/trunk/conifer/integration/uwindsor.py
   servres/trunk/conifer/libsystems/z3950/pyz3950_search.py
   servres/trunk/conifer/libsystems/z3950/yaz_search.py
   servres/trunk/conifer/local_settings.py.example
   servres/trunk/conifer/settings.py
   servres/trunk/conifer/syrup/models.py
   servres/trunk/conifer/syrup/urls.py
   servres/trunk/conifer/syrup/views/_common.py
   servres/trunk/conifer/syrup/views/admin.py
   servres/trunk/conifer/syrup/views/genshi_namespace.py
   servres/trunk/conifer/syrup/views/items.py
   servres/trunk/conifer/syrup/views/search.py
   servres/trunk/conifer/syrup/views/sites.py
   servres/trunk/conifer/templates/auth/login.xhtml
   servres/trunk/conifer/templates/generic/index.xhtml
   servres/trunk/conifer/templates/item/item_add_cat_search.xhtml
   servres/trunk/conifer/templates/paginate.xhtml
   servres/trunk/conifer/templates/phys/circlist_for_term.xhtml
Log:
moved marcxml to conifer.libsystems; removed refs to old campus integration module; cleanup.

I've left some of the campus refs, in code that I know is getting an
overhaul soon.

Modified: servres/trunk/conifer/integration/uwindsor.py
===================================================================
--- servres/trunk/conifer/integration/uwindsor.py	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/integration/uwindsor.py	2010-07-15 00:55:56 UTC (rev 922)
@@ -1,7 +1,7 @@
 from datetime import date
 from django.conf import settings
 from conifer.libsystems.evergreen.support import initialize, E1
-from conifer.libsystems.z3950 import marcxml as M
+from conifer.libsystems import marcxml as M
 from conifer.libsystems.evergreen import item_status as I
 from conifer.libsystems.z3950 import pyz3950_search as PZ
 from xml.etree import ElementTree as ET

Copied: servres/trunk/conifer/libsystems/marcxml.py (from rev 921, servres/trunk/conifer/libsystems/z3950/marcxml.py)
===================================================================
--- servres/trunk/conifer/libsystems/marcxml.py	                        (rev 0)
+++ servres/trunk/conifer/libsystems/marcxml.py	2010-07-15 00:55:56 UTC (rev 922)
@@ -0,0 +1,97 @@
+from xml.etree import ElementTree
+
+# Note: the 'record' parameters passed to these functions must be
+# Unicode strings, not plain Python strings; or ElementTree instances.
+
+def _to_tree(unicode_or_etree):
+    if isinstance(unicode_or_etree, unicode):
+        tree = ElementTree.fromstring(unicode_or_etree.encode('utf-8'))
+    elif isinstance(unicode_or_etree, ElementTree._ElementInterface):
+        tree = unicode_or_etree
+    else:
+        raise Exception('Bad parameter', unicode_or_etree)
+    return tree
+
+def marcxml_to_records(rec):
+    tree = _to_tree(rec)
+    if tree.tag == '{http://www.loc.gov/MARC21/slim}collection':
+        # then we may have multiple records
+        records = tree.findall('{http://www.loc.gov/MARC21/slim}record')
+    elif tree.tag == '{http://www.loc.gov/MARC21/slim}record':
+        records = [tree]
+    else:
+        return []
+    return records
+    
+def record_to_dictionary(rec, multiples=True):
+    tree = _to_tree(rec)
+    dct = {}
+    for df in tree.findall('{http://www.loc.gov/MARC21/slim}datafield'):
+        t = df.attrib['tag']
+        for sf in df.findall('{http://www.loc.gov/MARC21/slim}subfield'):
+            c = sf.attrib['code']
+            v = sf.text or ''
+            dct.setdefault(t+c, []).append(v)
+    dct = dict((k,'\n'.join(v or [])) for k,v in dct.items())
+    return dct
+
+def marcxml_to_dictionary(rec, multiples=False):
+    tree = _to_tree(rec)
+    if tree.tag == '{http://www.loc.gov/MARC21/slim}collection':
+        # then we may have multiple records
+        records = tree.findall('{http://www.loc.gov/MARC21/slim}record')
+    elif tree.tag == '{http://www.loc.gov/MARC21/slim}record':
+        records = [tree]
+    else:
+        return []
+    out = []
+    for r in records:
+        dct = {}
+        for df in r.findall('{http://www.loc.gov/MARC21/slim}datafield'):
+            t = df.attrib['tag']
+            for sf in df.findall('{http://www.loc.gov/MARC21/slim}subfield'):
+                c = sf.attrib['code']
+                v = sf.text or ''
+                dct.setdefault(t+c, []).append(v)
+        dct = dict((k,'\n'.join(v or [])) for k,v in dct.items())
+        out.append(dct)
+    if multiples is False:
+        return out and out[0] or None
+    else:
+        return out
+
+def marcxml_dictionary_to_dc(dct):
+    """Take a dictionary generated by marcxml_to_dictionary, and
+    extract some Dublin Core elements from it. Fixme, I'm sure this
+    could be way improved."""
+    out = {}
+    meta = [('245a', 'dc:title'),
+            ('260c', 'dc:date'), 
+            ('700a', 'dc:contributor')]
+    for marc, dc in meta:
+        value = dct.get(marc)
+        if value:
+            out[dc] = value
+
+    pub = [v.strip() for k,v in sorted(dct.items()) if k.startswith('260')]
+    if pub:
+        out['dc:publisher'] = strip_punct(' '.join(pub))
+
+    title = [v.strip() for k,v in sorted(dct.items()) if k in ('245a', '245b')]
+    if title:
+        out['dc:title'] = strip_punct(' '.join(title))
+
+    for k in ('100a', '110a', '700a', '710a'):
+        if dct.get(k):
+            out['dc:creator'] = strip_punct(dct[k])
+            break
+
+    return out
+
+    
+def strip_punct(s):
+    # strip whitespace and trailing single punctuation characters
+    s = s.strip()
+    if s and (s[-1] in ',.;:/'):
+        s = s[:-1]
+    return s.strip()

Deleted: servres/trunk/conifer/libsystems/z3950/marcxml.py
===================================================================
--- servres/trunk/conifer/libsystems/z3950/marcxml.py	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/libsystems/z3950/marcxml.py	2010-07-15 00:55:56 UTC (rev 922)
@@ -1,97 +0,0 @@
-from xml.etree import ElementTree
-
-# Note: the 'record' parameters passed to these functions must be
-# Unicode strings, not plain Python strings; or ElementTree instances.
-
-def _to_tree(unicode_or_etree):
-    if isinstance(unicode_or_etree, unicode):
-        tree = ElementTree.fromstring(unicode_or_etree.encode('utf-8'))
-    elif isinstance(unicode_or_etree, ElementTree._ElementInterface):
-        tree = unicode_or_etree
-    else:
-        raise Exception('Bad parameter', unicode_or_etree)
-    return tree
-
-def marcxml_to_records(rec):
-    tree = _to_tree(rec)
-    if tree.tag == '{http://www.loc.gov/MARC21/slim}collection':
-        # then we may have multiple records
-        records = tree.findall('{http://www.loc.gov/MARC21/slim}record')
-    elif tree.tag == '{http://www.loc.gov/MARC21/slim}record':
-        records = [tree]
-    else:
-        return []
-    return records
-    
-def record_to_dictionary(rec, multiples=True):
-    tree = _to_tree(rec)
-    dct = {}
-    for df in tree.findall('{http://www.loc.gov/MARC21/slim}datafield'):
-        t = df.attrib['tag']
-        for sf in df.findall('{http://www.loc.gov/MARC21/slim}subfield'):
-            c = sf.attrib['code']
-            v = sf.text or ''
-            dct.setdefault(t+c, []).append(v)
-    dct = dict((k,'\n'.join(v or [])) for k,v in dct.items())
-    return dct
-
-def marcxml_to_dictionary(rec, multiples=False):
-    tree = _to_tree(rec)
-    if tree.tag == '{http://www.loc.gov/MARC21/slim}collection':
-        # then we may have multiple records
-        records = tree.findall('{http://www.loc.gov/MARC21/slim}record')
-    elif tree.tag == '{http://www.loc.gov/MARC21/slim}record':
-        records = [tree]
-    else:
-        return []
-    out = []
-    for r in records:
-        dct = {}
-        for df in r.findall('{http://www.loc.gov/MARC21/slim}datafield'):
-            t = df.attrib['tag']
-            for sf in df.findall('{http://www.loc.gov/MARC21/slim}subfield'):
-                c = sf.attrib['code']
-                v = sf.text or ''
-                dct.setdefault(t+c, []).append(v)
-        dct = dict((k,'\n'.join(v or [])) for k,v in dct.items())
-        out.append(dct)
-    if multiples is False:
-        return out and out[0] or None
-    else:
-        return out
-
-def marcxml_dictionary_to_dc(dct):
-    """Take a dictionary generated by marcxml_to_dictionary, and
-    extract some Dublin Core elements from it. Fixme, I'm sure this
-    could be way improved."""
-    out = {}
-    meta = [('245a', 'dc:title'),
-            ('260c', 'dc:date'), 
-            ('700a', 'dc:contributor')]
-    for marc, dc in meta:
-        value = dct.get(marc)
-        if value:
-            out[dc] = value
-
-    pub = [v.strip() for k,v in sorted(dct.items()) if k.startswith('260')]
-    if pub:
-        out['dc:publisher'] = strip_punct(' '.join(pub))
-
-    title = [v.strip() for k,v in sorted(dct.items()) if k in ('245a', '245b')]
-    if title:
-        out['dc:title'] = strip_punct(' '.join(title))
-
-    for k in ('100a', '110a', '700a', '710a'):
-        if dct.get(k):
-            out['dc:creator'] = strip_punct(dct[k])
-            break
-
-    return out
-
-    
-def strip_punct(s):
-    # strip whitespace and trailing single punctuation characters
-    s = s.strip()
-    if s and (s[-1] in ',.;:/'):
-        s = s[:-1]
-    return s.strip()

Modified: servres/trunk/conifer/libsystems/z3950/pyz3950_search.py
===================================================================
--- servres/trunk/conifer/libsystems/z3950/pyz3950_search.py	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/libsystems/z3950/pyz3950_search.py	2010-07-15 00:55:56 UTC (rev 922)
@@ -7,7 +7,7 @@
 import warnings
 import re
 import sys
-from marcxml import marcxml_to_dictionary
+from ..marcxml import marcxml_to_dictionary
 from xml.etree import ElementTree as ET
 
 try:

Modified: servres/trunk/conifer/libsystems/z3950/yaz_search.py
===================================================================
--- servres/trunk/conifer/libsystems/z3950/yaz_search.py	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/libsystems/z3950/yaz_search.py	2010-07-15 00:55:56 UTC (rev 922)
@@ -8,7 +8,7 @@
 import re
 import pexpect
 import sys
-from marcxml import marcxml_to_dictionary
+from ..marcxml import marcxml_to_dictionary
 
 LOG = None              #  for pexpect debugging, try LOG = sys.stderr
 YAZ_CLIENT = 'yaz-client'

Modified: servres/trunk/conifer/local_settings.py.example
===================================================================
--- servres/trunk/conifer/local_settings.py.example	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/local_settings.py.example	2010-07-15 00:55:56 UTC (rev 922)
@@ -3,6 +3,8 @@
 import os
 from here import HERE
 
+DEBUG = False
+
 #----------------------------------------------------------------------
 # You may need to set the PYTHON_EGG_CACHE directory, depending on how
 # you installed Syrup.
@@ -19,7 +21,6 @@
 DATABASE_PORT     = '' # Set to empty string for default. Not used with sqlite3.
 
 #----------------------------------------------------------------------
-DEBUG = False
 
 ADMINS = (
     # ('Your Name', 'your_email at domain.com'),
@@ -31,18 +32,20 @@
 
 #----------------------------------------------------------------------
 
-EVERGREEN_AUTHENTICATION = False
+EVERGREEN_AUTHENTICATION = False # Evergreen ILS authentication
+LINKTOOL_AUTHENTICATION  = False # Sakai LMS Linktool authentication
 
 #----------------------------------------------------------------------
-#Campus integration
-
-CAMPUS_INTEGRATION_MODULE = 'conifer.integration.default'
-
-#----------------------------------------------------------------------
 # Stuff that probably belongs in a config table in the database, with
 # a nice UI to maintain it all.
 
 EVERGREEN_GATEWAY_SERVER = 'www.concat.ca'
 Z3950_CONFIG             = ('zed.concat.ca', 210, 'OWA')  #OWA,OSUL,CONIFER
-SIP_HOST                 = ('localhost', 8080)
-SIP_CREDENTIALS          = ('sipclient', 'c0n1fi3', 'graham home workstation')
+
+#----------------------------------------------------------------------
+# INTEGRATION_MODULE: name of a module to import after the database
+# models have been initialized. This can be used for defining 'hook'
+# functions, and other late initializations. 
+# See the 'conifer.syrup.integration' module for more information.
+
+INTEGRATION_MODULE = 'name.of.our.integration.module'

Modified: servres/trunk/conifer/settings.py
===================================================================
--- servres/trunk/conifer/settings.py	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/settings.py	2010-07-15 00:55:56 UTC (rev 922)
@@ -94,8 +94,6 @@
     'django.contrib.auth.backends.ModelBackend'
 ]
 
-CAMPUS_INTEGRATION_MODULE = 'conifer.integration.default'
-
 #---------------------------------------------------------------------------
 # local_settings.py
 
@@ -124,12 +122,3 @@
 
 #----------
 
-try:
-    exec 'import %s as CAMPUS_INTEGRATION' % CAMPUS_INTEGRATION_MODULE
-except:
-    raise Exception('There is an error in your campus integration module (%s)! '
-                    'Please investigate and repair.' % CAMPUS_INTEGRATION_MODULE,
-                    sys.exc_value)
-
-#----------
-

Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/syrup/models.py	2010-07-15 00:55:56 UTC (rev 922)
@@ -1,22 +1,17 @@
-import re
 import random
+import re
 
-from django.db                       import models as m
-from django.db.models                import Q
-from django.contrib.auth.models      import User
-from django.contrib.auth.models      import AnonymousUser
-from datetime                        import datetime
-from genshi                          import Markup
-from django.utils.translation        import ugettext as _
-from django.utils                    import simplejson
+from conifer.libsystems              import marcxml as MX
 from conifer.plumbing.genshi_support import get_request
-
-# campus and library integration
 from conifer.plumbing.hooksystem     import *
+from datetime                        import datetime
 from django.conf                     import settings
-campus = settings.CAMPUS_INTEGRATION
-import conifer.libsystems.z3950.marcxml as MX
+from django.contrib.auth.models      import AnonymousUser, User
+from django.db                       import models as m
+from django.db.models                import Q
 from django.utils                    import simplejson as json
+from django.utils.translation        import ugettext as _
+from genshi                          import Markup
 
 #----------------------------------------------------------------------
 

Modified: servres/trunk/conifer/syrup/urls.py
===================================================================
--- servres/trunk/conifer/syrup/urls.py	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/syrup/urls.py	2010-07-15 00:55:56 UTC (rev 922)
@@ -10,7 +10,6 @@
     (r'^$', 'welcome'),                       
     (r'^site/$', 'my_sites'),
     (r'^site/new/$', 'add_new_site'),
-    (r'^site/new/ajax_title$', 'add_new_site_ajax_title'),
     (r'^site/invitation/$', 'site_invitation'),
     (r'^browse/$', 'browse'),
     (r'^browse/(?P<browse_option>.*)/$', 'browse'),

Modified: servres/trunk/conifer/syrup/views/_common.py
===================================================================
--- servres/trunk/conifer/syrup/views/_common.py	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/syrup/views/_common.py	2010-07-15 00:55:56 UTC (rev 922)
@@ -20,6 +20,7 @@
 import warnings
 import pdb
 
+from conifer.integration.hooksystem import gethook, callhook, callhook_required
 from conifer.syrup                  import models
 from datetime                       import datetime
 from django.contrib.auth            import authenticate, login, logout
@@ -37,8 +38,8 @@
 from django.utils.translation       import ugettext as _
 from _generics                      import * # TODO: should not import-star
 
-from conifer.libsystems.z3950.marcxml import (marcxml_to_dictionary,
-                                              marcxml_dictionary_to_dc)
+from conifer.libsystems.marcxml     import (marcxml_to_dictionary,
+                                            marcxml_dictionary_to_dc)
 
 
 #-----------------------------------------------------------------------------

Modified: servres/trunk/conifer/syrup/views/admin.py
===================================================================
--- servres/trunk/conifer/syrup/views/admin.py	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/syrup/views/admin.py	2010-07-15 00:55:56 UTC (rev 922)
@@ -1,6 +1,5 @@
 from _common import *
 from django.utils.translation import ugettext as _
-from conifer.plumbing.hooksystem import *
 from datetime import date
 
 #-----------------------------------------------------------------------------

Modified: servres/trunk/conifer/syrup/views/genshi_namespace.py
===================================================================
--- servres/trunk/conifer/syrup/views/genshi_namespace.py	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/syrup/views/genshi_namespace.py	2010-07-15 00:55:56 UTC (rev 922)
@@ -1,38 +1,17 @@
-# genshi_namespace
+# genshi_namespace: toplevel definitions in this module will be
+# available when rendering a Genshi template. In addition, the Genshi
+# template will have access to:
 
-# Toplevel definitions in this module will be available in when
-# rendering a Genshi template.
+# request: the current request object
+# user:    the current user
+# ROOT:    the SCRIPT_NAME of the root directory of this application.
+# errors:  either None, or a list of errors related to the current page.
 
-from conifer.integration._hooksystem import gethook, callhook
-import itertools
-from itertools import cycle
-from conifer.syrup import models
 import django.forms
-from django.utils import translation
+import itertools
 
-_ = translation.ugettext
+from conifer.integration.hooksystem import gethook, callhook
+from conifer.syrup                  import models
+from django.utils                   import translation
 
-# this probably ought to be a method on User, or another model class.
-def instructor_url(instructor, suffix=''):
-    return '/instructor/%d/%s' % (instructor.id, suffix)
-
-# added to make department browse
-def department_url(department, suffix=''):
-    return '/department/%d/%s' % (department.id, suffix)
-
-
-def call_or_value(obj, dflt=None):
-    # This is used by the generics templates.
-    if callable(obj):
-        return obj() or dflt
-    else:
-        return obj or dflt
-
-
-def instructs(user, site):
-    try:
-        mbr = models.Member.objects.get(user=user, site=site)
-        return mbr.role in ('INSTR', 'PROXY')
-    except:
-        return False
-    
+_ = translation.ugettext

Modified: servres/trunk/conifer/syrup/views/items.py
===================================================================
--- servres/trunk/conifer/syrup/views/items.py	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/syrup/views/items.py	2010-07-15 00:55:56 UTC (rev 922)
@@ -1,10 +1,8 @@
-from _common import *
+from _common                  import *
+from conifer.syrup            import integration
 from django.utils.translation import ugettext as _
-from xml.etree import ElementTree as ET
-from conifer.syrup import integration
-from conifer.plumbing.hooksystem import *
+from xml.etree                import ElementTree as ET
 
-
 @members_only
 def item_detail(request, site_id, item_id):
     """Display an item (however that makes sense).""" 

Modified: servres/trunk/conifer/syrup/views/search.py
===================================================================
--- servres/trunk/conifer/syrup/views/search.py	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/syrup/views/search.py	2010-07-15 00:55:56 UTC (rev 922)
@@ -95,8 +95,6 @@
     site_filter  = Q(site=for_site)         if for_site  else Q()
 
     _items       = models.Item.objects.select_related()
-    print (term_filter & user_filter &
-                                 site_filter & owner_filter)
     items        = _items.filter(term_filter & user_filter &
                                  site_filter & owner_filter)
 
@@ -139,9 +137,6 @@
         this instructor.
     '''
 
-    print("in_site is %s" % in_site)
-    print("for_owner is %s" % for_owner)
-
     query_string = request.GET.get('q', '').strip()
 
     if not query_string:        # empty query?

Modified: servres/trunk/conifer/syrup/views/sites.py
===================================================================
--- servres/trunk/conifer/syrup/views/sites.py	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/syrup/views/sites.py	2010-07-15 00:55:56 UTC (rev 922)
@@ -12,7 +12,7 @@
 
     def clean_code(self):
         v = (self.cleaned_data.get('code') or '').strip()
-        is_valid_func = models.campus.course_code_is_valid
+        is_valid_func = gethook('course_code_is_valid')
         if (not is_valid_func) or is_valid_func(v):
             return v
         else:
@@ -26,22 +26,6 @@
         super(NewSiteForm, self).__init__(*args, **kwargs)
 
 
-# if we have course-code lookup, hack lookup support into the new-course form.
-
-COURSE_CODE_LIST = bool(models.campus.course_code_list)
-COURSE_CODE_LOOKUP_TITLE = bool(models.campus.course_code_lookup_title)
-
-# if COURSE_CODE_LIST:
-#     from django.forms import Select
-#     course_list = models.campus.course_code_list()
-#     choices = [(a,a) for a in course_list]
-#     choices.sort()
-#     empty_label = u'---------'
-#     choices.insert(0, ('', empty_label))
-#     NewSiteForm.base_fields['code'].widget = Select(
-#         choices = choices)
-#     NewSiteForm.base_fields['code'].empty_label = empty_label
-
 #--------------------
 
 @login_required
@@ -60,7 +44,6 @@
     if is_add:
         instance = models.Site()
     current_access_level = not is_add and instance.access or None
-    example = models.campus.course_code_example
     if request.method != 'POST':
         form = NewSiteForm(instance=instance)
         return g.render('edit_site.xhtml', **locals())
@@ -82,12 +65,6 @@
             else:
                 return HttpResponseRedirect('../') # back to main view.
 
-# no access-control needed to protect title lookup.
-def add_new_site_ajax_title(request):
-    course_code = request.GET['course_code']
-    title = models.campus.course_code_lookup_title(course_code)
-    return HttpResponse(simplejson.dumps({'title':title}))
-
 @instructors_only
 def edit_site_permissions(request, site_id):
     site = get_object_or_404(models.Site, pk=site_id)
@@ -100,6 +77,7 @@
         (u'STUDT', _(u'Students in my course -- I will provide section numbers')),
         (u'INVIT', _(u'Students in my course -- I will share an Invitation Code with them')),
         (u'LOGIN', _(u'All Reserves patrons'))]
+    # TODO: fixme, campus module no longer exists.
     if models.campus.sections_tuple_delimiter is None:
         # no course-sections support? Then STUDT cannot be an option.
         del choices[1]

Modified: servres/trunk/conifer/templates/auth/login.xhtml
===================================================================
--- servres/trunk/conifer/templates/auth/login.xhtml	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/templates/auth/login.xhtml	2010-07-15 00:55:56 UTC (rev 922)
@@ -1,5 +1,5 @@
 <?python
-title = _('Please log in')
+title = _('Please log in.')
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:xi="http://www.w3.org/2001/XInclude"
@@ -12,7 +12,8 @@
   </script>
 </head>
 <body>
-  <h1>Please log in.</h1>
+  <h1>${title}</h1>
+  <p>You must log in to access this resource.</p>
   <form action="." method="post">
     <input type="hidden" name="next" value="${next}"/>
     <div class="errors" py:if="defined('err')">${err}</div>

Modified: servres/trunk/conifer/templates/generic/index.xhtml
===================================================================
--- servres/trunk/conifer/templates/generic/index.xhtml	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/templates/generic/index.xhtml	2010-07-15 00:55:56 UTC (rev 922)
@@ -1,6 +1,11 @@
 <?python
 index = form.Index
 title = index.title
+def call_or_value(obj, dflt=None):
+    if callable(obj):
+        return obj() or dflt
+    else:
+        return obj or dflt
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:xi="http://www.w3.org/2001/XInclude"

Modified: servres/trunk/conifer/templates/item/item_add_cat_search.xhtml
===================================================================
--- servres/trunk/conifer/templates/item/item_add_cat_search.xhtml	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/templates/item/item_add_cat_search.xhtml	2010-07-15 00:55:56 UTC (rev 922)
@@ -1,8 +1,8 @@
 <?python
 from django.utils.simplejson import dumps
 from xml.etree import ElementTree as ET
-from conifer.libsystems.z3950.marcxml import record_to_dictionary
-from conifer.libsystems.z3950.marcxml import marcxml_dictionary_to_dc as to_dublin
+from conifer.libsystems.marcxml import record_to_dictionary
+from conifer.libsystems.marcxml import marcxml_dictionary_to_dc as to_dublin
 title = _('Add physical or electronic item, by catalogue search')
 helptext = _('Use keywords or CCL syntax for searching, for example: ti="detroit river" and au="wilgus"')
 dc_keys = ['dc:title', 'dc:creator', 'dc:publisher', 'dc:date']

Modified: servres/trunk/conifer/templates/paginate.xhtml
===================================================================
--- servres/trunk/conifer/templates/paginate.xhtml	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/templates/paginate.xhtml	2010-07-15 00:55:56 UTC (rev 922)
@@ -4,7 +4,7 @@
       py:strip="">
 <div py:def="pagetable(paginator, count, pagerow, pagehead=None, query=None, target=None)"
      py:with="page = paginator.page(page_num)">
-  <table class="pagetable" py:with="cls = cycle(('odd', 'even'))"> 
+  <table class="pagetable" py:with="cls = itertools.cycle(('odd', 'even'))"> 
     <thead py:if="pagehead">
       ${pagehead()}
     </thead>

Modified: servres/trunk/conifer/templates/phys/circlist_for_term.xhtml
===================================================================
--- servres/trunk/conifer/templates/phys/circlist_for_term.xhtml	2010-07-15 00:55:50 UTC (rev 921)
+++ servres/trunk/conifer/templates/phys/circlist_for_term.xhtml	2010-07-15 00:55:56 UTC (rev 922)
@@ -1,6 +1,6 @@
 <?python
 title = _('Wanted items: %s') % term
-from conifer.libsystems.z3950.marcxml import marcxml_dictionary_to_dc as to_dublin
+from conifer.libsystems.marcxml import marcxml_dictionary_to_dc as to_dublin
 dc_keys = ['dc:title', 'dc:creator', 'dc:publisher', 'dc:date']
 from django.conf import settings
 lang = settings.LANGUAGE_CODE.replace('_','-')



More information about the open-ils-commits mailing list