Merge pull request #1101 from bookwyrm-social/import-errors

Catch unexpectedly missing columns in csv imports
This commit is contained in:
Mouse Reeve 2021-05-20 14:58:06 -07:00 committed by GitHub
commit 69a1f6a618
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 45 deletions

View file

@ -7,6 +7,7 @@ from django.http import HttpResponseBadRequest
from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from django.utils.decorators import method_decorator
from django.utils.translation import gettext_lazy as _
from django.views import View
from bookwyrm import forms, models
@ -62,8 +63,8 @@ class Import(View):
include_reviews,
privacy,
)
except (UnicodeDecodeError, ValueError):
return HttpResponseBadRequest("Not a valid csv file")
except (UnicodeDecodeError, ValueError, KeyError):
return HttpResponseBadRequest(_("Not a valid csv file"))
importer.start_import(job)

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-05-20 12:12-0700\n"
"POT-Creation-Date: 2021-05-20 14:40-0700\n"
"PO-Revision-Date: 2021-03-02 17:19-0800\n"
"Last-Translator: Mouse Reeve <mousereeve@riseup.net>\n"
"Language-Team: English <LL@li.org>\n"
@ -658,7 +658,7 @@ msgstr "bewertet"
#: bookwyrm/templates/get_started/layout.html:19
#: bookwyrm/templates/get_started/layout.html:52
#: bookwyrm/templates/search/book.html:32
#: bookwyrm/templates/snippets/announcement.html:17
#: bookwyrm/templates/snippets/announcement.html:18
msgid "Close"
msgstr "Schließen"
@ -703,7 +703,7 @@ msgid "You can opt-out at any time in your <a href=\"%(path)s\">profile settings
msgstr "Du kannst dein Leseziel jederzeit auf deiner <a href=\"%(path)s\">Profilseite</a> setzen oder ändern."
#: bookwyrm/templates/directory/directory.html:29
#: bookwyrm/templates/snippets/announcement.html:30
#: bookwyrm/templates/snippets/announcement.html:34
#: bookwyrm/templates/snippets/goal_card.html:22
msgid "Dismiss message"
msgstr "Nachricht verwerfen"
@ -1465,7 +1465,7 @@ msgstr "Alle können Bücher vorschlagen, du kannst diese bestätigen"
#: bookwyrm/templates/lists/form.html:31
#: bookwyrm/templates/moderation/reports.html:25
#: bookwyrm/templates/search/book.html:30
#: bookwyrm/templates/snippets/announcement.html:15
#: bookwyrm/templates/snippets/announcement.html:16
msgid "Open"
msgstr "Offen"
@ -2429,7 +2429,7 @@ msgstr "Folgeanfragen"
msgid "Registration closed text:"
msgstr "Registrierungen geschlossen text"
#: bookwyrm/templates/snippets/announcement.html:27
#: bookwyrm/templates/snippets/announcement.html:31
#, fuzzy, python-format
#| msgid "Direct Messages with <a href=\"%(path)s\">%(username)s</a>"
msgid "Posted by <a href=\"%(user_path)s\">%(username)s</a>"
@ -3158,6 +3158,12 @@ msgstr ""
msgid "Access level:"
msgstr ""
#: bookwyrm/views/import_data.py:67
#, fuzzy
#| msgid "Email address:"
msgid "Not a valid csv file"
msgstr "E-Mail Adresse"
#: bookwyrm/views/password.py:32
#, fuzzy
#| msgid "A user with that username already exists."
@ -3184,11 +3190,6 @@ msgstr ""
#~ msgid "Messages"
#~ msgstr "Alle Nachrichten"
#, fuzzy
#~| msgid "Email address:"
#~ msgid "Enter a valid value."
#~ msgstr "E-Mail Adresse"
#, fuzzy
#~| msgid "Email address:"
#~ msgid "Enter a valid URL."

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-05-20 12:12-0700\n"
"POT-Creation-Date: 2021-05-20 14:40-0700\n"
"PO-Revision-Date: 2021-02-28 17:19-0800\n"
"Last-Translator: Mouse Reeve <mousereeve@riseup.net>\n"
"Language-Team: English <LL@li.org>\n"
@ -608,7 +608,7 @@ msgstr ""
#: bookwyrm/templates/get_started/layout.html:19
#: bookwyrm/templates/get_started/layout.html:52
#: bookwyrm/templates/search/book.html:32
#: bookwyrm/templates/snippets/announcement.html:17
#: bookwyrm/templates/snippets/announcement.html:18
msgid "Close"
msgstr ""
@ -644,7 +644,7 @@ msgid "You can opt-out at any time in your <a href=\"%(path)s\">profile settings
msgstr ""
#: bookwyrm/templates/directory/directory.html:29
#: bookwyrm/templates/snippets/announcement.html:30
#: bookwyrm/templates/snippets/announcement.html:34
#: bookwyrm/templates/snippets/goal_card.html:22
msgid "Dismiss message"
msgstr ""
@ -1365,7 +1365,7 @@ msgstr ""
#: bookwyrm/templates/lists/form.html:31
#: bookwyrm/templates/moderation/reports.html:25
#: bookwyrm/templates/search/book.html:30
#: bookwyrm/templates/snippets/announcement.html:15
#: bookwyrm/templates/snippets/announcement.html:16
msgid "Open"
msgstr ""
@ -2216,7 +2216,7 @@ msgstr ""
msgid "Registration closed text:"
msgstr ""
#: bookwyrm/templates/snippets/announcement.html:27
#: bookwyrm/templates/snippets/announcement.html:31
#, python-format
msgid "Posted by <a href=\"%(user_path)s\">%(username)s</a>"
msgstr ""
@ -2886,6 +2886,10 @@ msgstr ""
msgid "Access level:"
msgstr ""
#: bookwyrm/views/import_data.py:67
msgid "Not a valid csv file"
msgstr ""
#: bookwyrm/views/password.py:32
msgid "No user with that email address was found."
msgstr ""

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-05-20 12:12-0700\n"
"POT-Creation-Date: 2021-05-20 14:40-0700\n"
"PO-Revision-Date: 2021-03-19 11:49+0800\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -626,7 +626,7 @@ msgstr "lo calificó con"
#: bookwyrm/templates/get_started/layout.html:19
#: bookwyrm/templates/get_started/layout.html:52
#: bookwyrm/templates/search/book.html:32
#: bookwyrm/templates/snippets/announcement.html:17
#: bookwyrm/templates/snippets/announcement.html:18
msgid "Close"
msgstr "Cerrar"
@ -662,7 +662,7 @@ msgid "You can opt-out at any time in your <a href=\"%(path)s\">profile settings
msgstr "Puedes optar por no en cualquier hora en tus <a href=\"%(path)s\">configuraciones de perfil.</a>"
#: bookwyrm/templates/directory/directory.html:29
#: bookwyrm/templates/snippets/announcement.html:30
#: bookwyrm/templates/snippets/announcement.html:34
#: bookwyrm/templates/snippets/goal_card.html:22
msgid "Dismiss message"
msgstr "Desechar mensaje"
@ -1385,7 +1385,7 @@ msgstr "Cualquier usuario puede sugerir libros, en cuanto lo hayas aprobado"
#: bookwyrm/templates/lists/form.html:31
#: bookwyrm/templates/moderation/reports.html:25
#: bookwyrm/templates/search/book.html:30
#: bookwyrm/templates/snippets/announcement.html:15
#: bookwyrm/templates/snippets/announcement.html:16
msgid "Open"
msgstr "Abierto"
@ -2274,7 +2274,7 @@ msgstr "Permitir solicitudes de invitación:"
msgid "Registration closed text:"
msgstr "Texto de registración cerrada:"
#: bookwyrm/templates/snippets/announcement.html:27
#: bookwyrm/templates/snippets/announcement.html:31
#, fuzzy, python-format
#| msgid "Added by <a href=\"%(user_path)s\">%(username)s</a>"
msgid "Posted by <a href=\"%(user_path)s\">%(username)s</a>"
@ -2956,6 +2956,12 @@ msgstr "Des-suspender usuario"
msgid "Access level:"
msgstr "Nivel de acceso:"
#: bookwyrm/views/import_data.py:67
#, fuzzy
#| msgid "Enter a valid value."
msgid "Not a valid csv file"
msgstr "Ingrese un valor válido."
#: bookwyrm/views/password.py:32
msgid "No user with that email address was found."
msgstr "No se pudo encontrar un usuario con esa dirección de correo electrónico."
@ -3000,9 +3006,6 @@ msgstr "Un enlace para reestablecer tu contraseña se enviará a %s"
#~ msgid "That page contains no results"
#~ msgstr "Esa pagina no contiene resultados"
#~ msgid "Enter a valid value."
#~ msgstr "Ingrese un valor válido."
#~ msgid "Enter a valid URL."
#~ msgstr "Ingrese una URL válida."

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-05-20 12:12-0700\n"
"POT-Creation-Date: 2021-05-20 14:40-0700\n"
"PO-Revision-Date: 2021-04-05 12:44+0100\n"
"Last-Translator: Fabien Basmaison <contact@arkhi.org>\n"
"Language-Team: Mouse Reeve <LL@li.org>\n"
@ -632,7 +632,7 @@ msgstr "la noté"
#: bookwyrm/templates/get_started/layout.html:19
#: bookwyrm/templates/get_started/layout.html:52
#: bookwyrm/templates/search/book.html:32
#: bookwyrm/templates/snippets/announcement.html:17
#: bookwyrm/templates/snippets/announcement.html:18
msgid "Close"
msgstr "Fermer"
@ -668,7 +668,7 @@ msgid "You can opt-out at any time in your <a href=\"%(path)s\">profile settings
msgstr "Vous pouvez décider de ne plus y figurer à nimporte quel moment depuis vos <a href=\"%(path)s\">paramètres de profil.</a>"
#: bookwyrm/templates/directory/directory.html:29
#: bookwyrm/templates/snippets/announcement.html:30
#: bookwyrm/templates/snippets/announcement.html:34
#: bookwyrm/templates/snippets/goal_card.html:22
msgid "Dismiss message"
msgstr "Rejeter le message"
@ -1391,7 +1391,7 @@ msgstr "Nimporte qui peut suggérer des livres, soumis à votre approbation"
#: bookwyrm/templates/lists/form.html:31
#: bookwyrm/templates/moderation/reports.html:25
#: bookwyrm/templates/search/book.html:30
#: bookwyrm/templates/snippets/announcement.html:15
#: bookwyrm/templates/snippets/announcement.html:16
msgid "Open"
msgstr "Ouverte"
@ -2304,7 +2304,7 @@ msgstr "Autoriser les demandes dinvitation:"
msgid "Registration closed text:"
msgstr "Texte affiché lorsque les enregistrements sont clos:"
#: bookwyrm/templates/snippets/announcement.html:27
#: bookwyrm/templates/snippets/announcement.html:31
#, fuzzy, python-format
#| msgid "Added by <a href=\"%(user_path)s\">%(username)s</a>"
msgid "Posted by <a href=\"%(user_path)s\">%(username)s</a>"
@ -2991,6 +2991,12 @@ msgstr ""
msgid "Access level:"
msgstr ""
#: bookwyrm/views/import_data.py:67
#, fuzzy
#| msgid "Email address:"
msgid "Not a valid csv file"
msgstr "Adresse email:"
#: bookwyrm/views/password.py:32
msgid "No user with that email address was found."
msgstr "Aucun compte avec cette adresse email na été trouvé."
@ -3015,11 +3021,6 @@ msgstr "Un lien de réinitialisation a été envoyé à %s."
#~ msgid "Messages"
#~ msgstr "Tous les messages"
#, fuzzy
#~| msgid "Email address:"
#~ msgid "Enter a valid value."
#~ msgstr "Adresse email:"
#, fuzzy
#~| msgid "Email address:"
#~ msgid "Enter a valid URL."

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-05-20 12:12-0700\n"
"POT-Creation-Date: 2021-05-20 14:40-0700\n"
"PO-Revision-Date: 2021-03-20 00:56+0000\n"
"Last-Translator: Kana <gudzpoz@live.com>\n"
"Language-Team: Mouse Reeve <LL@li.org>\n"
@ -631,7 +631,7 @@ msgstr "评价了"
#: bookwyrm/templates/get_started/layout.html:19
#: bookwyrm/templates/get_started/layout.html:52
#: bookwyrm/templates/search/book.html:32
#: bookwyrm/templates/snippets/announcement.html:17
#: bookwyrm/templates/snippets/announcement.html:18
msgid "Close"
msgstr "关闭"
@ -669,7 +669,7 @@ msgid "You can opt-out at any time in your <a href=\"%(path)s\">profile settings
msgstr "你可以在任何时候从你的 <a href=\"%(path)s\">个人资料设定</a> 中退出。"
#: bookwyrm/templates/directory/directory.html:29
#: bookwyrm/templates/snippets/announcement.html:30
#: bookwyrm/templates/snippets/announcement.html:34
#: bookwyrm/templates/snippets/goal_card.html:22
msgid "Dismiss message"
msgstr "遣散消息"
@ -1388,7 +1388,7 @@ msgstr "任何人都可以推荐书目、主题让你批准"
#: bookwyrm/templates/lists/form.html:31
#: bookwyrm/templates/moderation/reports.html:25
#: bookwyrm/templates/search/book.html:30
#: bookwyrm/templates/snippets/announcement.html:15
#: bookwyrm/templates/snippets/announcement.html:16
msgid "Open"
msgstr "开放"
@ -2305,7 +2305,7 @@ msgstr "允许请求邀请:"
msgid "Registration closed text:"
msgstr "注册关闭文字:"
#: bookwyrm/templates/snippets/announcement.html:27
#: bookwyrm/templates/snippets/announcement.html:31
#, fuzzy, python-format
#| msgid "Added by <a href=\"%(user_path)s\">%(username)s</a>"
msgid "Posted by <a href=\"%(user_path)s\">%(username)s</a>"
@ -2989,6 +2989,12 @@ msgstr ""
msgid "Access level:"
msgstr ""
#: bookwyrm/views/import_data.py:67
#, fuzzy
#| msgid "Email address:"
msgid "Not a valid csv file"
msgstr "邮箱地址:"
#: bookwyrm/views/password.py:32
msgid "No user with that email address was found."
msgstr "没有找到使用该邮箱的用户。"
@ -3013,11 +3019,6 @@ msgstr "密码重置连接已发送给 %s"
#~ msgid "Messages"
#~ msgstr "所有消息"
#, fuzzy
#~| msgid "Email address:"
#~ msgid "Enter a valid value."
#~ msgstr "邮箱地址:"
#, fuzzy
#~| msgid "Email address:"
#~ msgid "Enter a valid URL."