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:
ans.append(('OCLC', 'oclc', oclc,
'http://www.worldcat.org/oclc/'+oclc))
url = identifiers.get('uri', None)
if url is None:
url = identifiers.get('url', None)
if url and url.startswith('http'):
url = url[:8].replace('|', ':') + url[8:].replace('|', ',')
parts = urlparse(url)
name = parts.netloc
ans.append((name, 'url', url, url))
for x in ('uri', 'url'):
url = identifiers.get(x, None)
if url and url.startswith('http'):
url = url[:8].replace('|', ':') + url[8:].replace('|', ',')
parts = urlparse(url)
name = parts.netloc
ans.append((name, x, url, url))
return ans
# }}}