ALlow using both uri: and url: identifiers to create two different links

instead of just one in the Book details panel
This commit is contained in:
Kovid Goyal 2013-10-07 12:51:35 +05:30
parent 980ecc2e12
commit 254b00c864

View File

@ -537,14 +537,13 @@ def urls_from_identifiers(identifiers): # {{{
if oclc: if oclc:
ans.append(('OCLC', 'oclc', oclc, ans.append(('OCLC', 'oclc', oclc,
'http://www.worldcat.org/oclc/'+oclc)) 'http://www.worldcat.org/oclc/'+oclc))
url = identifiers.get('uri', None) for x in ('uri', 'url'):
if url is None: url = identifiers.get(x, None)
url = identifiers.get('url', None) if url and url.startswith('http'):
if url and url.startswith('http'): url = url[:8].replace('|', ':') + url[8:].replace('|', ',')
url = url[:8].replace('|', ':') + url[8:].replace('|', ',') parts = urlparse(url)
parts = urlparse(url) name = parts.netloc
name = parts.netloc ans.append((name, x, url, url))
ans.append((name, 'url', url, url))
return ans return ans
# }}} # }}}