fic empty new edition
fix error when user click new edition without entering anythingpull/94/head
parent
194950e2a5
commit
9a411f1906
|
@ -43,6 +43,8 @@ def scrape_sitemap(url, maxnum=None):
|
|||
logger.error(e)
|
||||
|
||||
def add_by_webpage(url, work=None, user=None):
|
||||
if not url:
|
||||
return None
|
||||
edition = None
|
||||
scraper = get_scraper(url)
|
||||
loader = BasePandataLoader(url)
|
||||
|
|
|
@ -360,6 +360,8 @@ ID_URLPATTERNS = {
|
|||
|
||||
def ids_from_urls(url):
|
||||
ids = {}
|
||||
if not url:
|
||||
return ids
|
||||
for ident, pattern in ID_URLPATTERNS.items():
|
||||
id_match = pattern.search(url)
|
||||
if id_match:
|
||||
|
|
|
@ -160,12 +160,13 @@ def new_edition(request, by=None):
|
|||
else:
|
||||
edition = get_edition_for_id(id_type, id_value, user=request.user)
|
||||
|
||||
return HttpResponseRedirect(
|
||||
reverse('new_edition', kwargs={
|
||||
'work_id': edition.work_id,
|
||||
'edition_id': edition.id
|
||||
})
|
||||
)
|
||||
if edition:
|
||||
return HttpResponseRedirect(
|
||||
reverse('new_edition', kwargs={
|
||||
'work_id': edition.work_id,
|
||||
'edition_id': edition.id
|
||||
})
|
||||
)
|
||||
else:
|
||||
form = IdentifierForm()
|
||||
return render(request, 'new_edition.html', {'form': form, 'alert':alert})
|
||||
|
|
Loading…
Reference in New Issue