# $Id$ # $URL$ logger = logging.getLogger('meresco.availability') logger.debug("Starting logger") #FIXME: config namespaceMap = { 'mods': 'http://www.loc.gov/mods/v3' } def inDepot(location): # FIXME: config # Moet overeenkomen met openurl.js if location.split()[0] in ['CBM', 'CBC', 'KHS', 'KOD', 'TRE', 'SOC']: return 1 if len(location.split()) > 1: collection = location.split()[0] + " " + location.split()[1] if collection in ['TF PRE', 'TF HS', 'TF INC', 'TFK E', 'KTFK HS', 'KTFK INC']: return 1 else: return 0 else: return 0 def getLocator(recordId, mods): sid = any.getSid(recordId) locator = any.createOpenURL(mods) # TP: use the following for testing with locator @ bzv.uvt.nl # locator = "/availability/?" + any.createOpenURL(mods).split('?')[1] return locator + '&sid=' + sid def getAvailabilityByOpenurl(recordId, mods, ID): locator = getLocator(recordId, mods) yield """ """ % {'locator' : locator, 'id' : ID } def getAvailabilityByUitleencode(mods, genre, recordId ): # uitleencodes # a = titel in bestelling # c = niet balie, wel IBL # d = wel balie, niet IBL # e = elektronisch beschikbaar # g = geblokkeerd # o = onbekend # s = speciale toestemming # z = boek zoek # f = niet uitleenbaar, wel fotokopie # i = niet uitleenbaar, geen fotokopie, wel inzage # u = normaal uitleenbaar # b = beperkt uitleenbaar askServer = [] for copyInformation in mods.xpath("//mods:location/mods:holdingSimple/mods:copyInformation", namespaceMap): uitleencode = copyInformation.xpath("mods:note[@type='status']/text()", namespaceMap) if not uitleencode: pass elif uitleencode[0] == 'i' or uitleencode[0] == 'f': location = copyInformation.xpath("mods:shelfLocator/text()", namespaceMap)[0] if inDepot(location): # FIXME: config yield '