コード例 #1
0
ファイル: views.py プロジェクト: leighannskeen/launchpad
def non_wrlc_item(request, num, num_type):
    bib = apis.get_bib_data(num=num, num_type=num_type)
    if not bib:
        return render(request, '404.html', {'num': num,
                                            'num_type': num_type.upper()}, status=404)
    bib['openurl'] = _openurl_dict(request)
    bib['citation_json'] = citation_json(request)
    bib['ILLIAD_LINK'] = voyager.get_illiad_link(bib)
    try:
        bib['REFWORKS_LINK'] = voyager.get_refworks_link(bib)
    except:
        bib['REFWORKS_LINK'] = ''
    bib['MICRODATA_TYPE'] = voyager.get_microdata_type(bib)
    holdings = []
    # get free electronic book link from open library
    for numformat in ('LCCN', 'ISBN', 'OCLC'):
        if bib.get(numformat):
            if numformat == 'OCLC':
                num = filter(lambda x: x.isdigit(), bib[numformat])
            else:
                num = bib[numformat]
            openlibhold = apis.openlibrary(num, numformat)
            if openlibhold:
                holdings.append(openlibhold)
                break
    return render(request, 'item.html', {
        'bibid': '',
        'bib': bib,
        'non_gw': True,
        'holdings': holdings,
        'link': '',
        'show_ill_link': True
    })
コード例 #2
0
ファイル: views.py プロジェクト: pombredanne/launchpad-1
def non_wrlc_item(request, num, num_type):
    bib = apis.get_bib_data(num=num, num_type=num_type)
    if not bib:
        return render(request, '404.html', {'num': num,
                      'num_type': num_type.upper()}, status=404)
    bib['openurl'] = _openurl_dict(request)
    bib['citation_json'] = citation_json(request)
    bib['ILLIAD_LINK'] = voyager.get_illiad_link(bib)
    bib['MICRODATA_TYPE'] = voyager.get_microdata_type(bib)
    holdings = []
    # get free electronic book link from open library
    for numformat in ('LCCN', 'ISBN', 'OCLC'):
        if bib.get(numformat):
            if numformat == 'OCLC':
                num = filter(lambda x: x.isdigit(), bib[numformat])
            else:
                num = bib[numformat]
            openlibhold = apis.openlibrary(num, numformat)
            if openlibhold:
                holdings.append(openlibhold)
                break
    return render(request, 'item.html', {
                  'bibid': '',
                  'bib': bib,
                  'non_gw': True,
                  'debug': settings.DEBUG,
                  'title_chars': settings.TITLE_CHARS,
                  'title_leftover_chars': settings.TITLE_LEFTOVER_CHARS,
                  'holdings': holdings,
                  'link': '',
                  'google_analytics_ua': settings.GOOGLE_ANALYTICS_UA,
                  'link_resolver': settings.LINK_RESOLVER,
                  'audio_tags': settings.STREAMING_AUDIO_TAGS,
                  'video_tags': settings.STREAMING_VIDEO_TAGS,
                  })
コード例 #3
0
ファイル: views.py プロジェクト: pombredanne/launchpad-1
def non_wrlc_item(request, num, num_type):
    bib = apis.get_bib_data(num=num, num_type=num_type)
    if not bib:
        return render(request,
                      '404.html', {
                          'num': num,
                          'num_type': num_type.upper()
                      },
                      status=404)
    bib['openurl'] = _openurl_dict(request)
    bib['citation_json'] = citation_json(request)
    bib['ILLIAD_LINK'] = voyager.get_illiad_link(bib)
    bib['MICRODATA_TYPE'] = voyager.get_microdata_type(bib)
    holdings = []
    # get free electronic book link from open library
    for numformat in ('LCCN', 'ISBN', 'OCLC'):
        if bib.get(numformat):
            if numformat == 'OCLC':
                num = filter(lambda x: x.isdigit(), bib[numformat])
            else:
                num = bib[numformat]
            openlibhold = apis.openlibrary(num, numformat)
            if openlibhold:
                holdings.append(openlibhold)
                break
    return render(
        request, 'item.html', {
            'bibid': '',
            'bib': bib,
            'non_gw': True,
            'debug': settings.DEBUG,
            'title_chars': settings.TITLE_CHARS,
            'title_leftover_chars': settings.TITLE_LEFTOVER_CHARS,
            'holdings': holdings,
            'link': '',
            'google_analytics_ua': settings.GOOGLE_ANALYTICS_UA,
            'link_resolver': settings.LINK_RESOLVER,
            'audio_tags': settings.STREAMING_AUDIO_TAGS,
            'video_tags': settings.STREAMING_VIDEO_TAGS,
        })