#419 - aftermath

- remove accidental print statements left over from debugging
- create missing groups on import

Signed-off-by: René Köcher <shirk@bitspin.org>
This commit is contained in:
René Köcher 2012-11-22 10:26:44 +01:00
parent 36f83808fd
commit 9f51a24311
3 changed files with 73 additions and 54 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: OpenSlides 1.x\n" "Project-Id-Version: OpenSlides 1.x\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-21 23:23+0100\n" "POT-Creation-Date: 2012-11-22 10:22+0100\n"
"PO-Revision-Date: 2012-07-28 11:07+0200\n" "PO-Revision-Date: 2012-07-28 11:07+0200\n"
"Last-Translator: Emanuel Schuetze <emanuel@intevation.de>\n" "Last-Translator: Emanuel Schuetze <emanuel@intevation.de>\n"
"Language-Team: support@openslides.de\n" "Language-Team: support@openslides.de\n"
@ -231,7 +231,7 @@ msgstr "Möchten Sie die geänderte Reihenfolge der Einträge speichern?"
#: assignment/templates/assignment/view.html:172 #: assignment/templates/assignment/view.html:172
#: assignment/templates/projector/Assignment.html:78 #: assignment/templates/projector/Assignment.html:78
#: assignment/templates/projector/Assignment.html:82 motion/models.py:579 #: assignment/templates/projector/Assignment.html:82 motion/models.py:579
#: motion/views.py:833 motion/views.py:884 #: motion/views.py:842 motion/views.py:893
#: motion/templates/motion/view.html:79 #: motion/templates/motion/view.html:79
#: motion/templates/projector/Motion.html:37 utils/utils.py:53 #: motion/templates/projector/Motion.html:37 utils/utils.py:53
#: utils/views.py:111 #: utils/views.py:111
@ -241,7 +241,7 @@ msgstr "Ja"
#: agenda/templates/agenda/overview.html:47 assignment/models.py:301 #: agenda/templates/agenda/overview.html:47 assignment/models.py:301
#: assignment/views.py:580 assignment/templates/assignment/view.html:169 #: assignment/views.py:580 assignment/templates/assignment/view.html:169
#: assignment/templates/projector/Assignment.html:79 motion/models.py:579 #: assignment/templates/projector/Assignment.html:79 motion/models.py:579
#: motion/views.py:833 motion/views.py:885 #: motion/views.py:842 motion/views.py:894
#: motion/templates/motion/view.html:80 #: motion/templates/motion/view.html:80
#: motion/templates/projector/Motion.html:38 utils/utils.py:53 #: motion/templates/projector/Motion.html:38 utils/utils.py:53
#: utils/views.py:111 #: utils/views.py:111
@ -483,7 +483,7 @@ msgstr "Neue Wahl wurde erfolgreich angelegt."
msgid "Election was successfully modified." msgid "Election was successfully modified."
msgstr "Wahl wurde erfolgreich geändert." msgstr "Wahl wurde erfolgreich geändert."
#: assignment/views.py:138 motion/views.py:257 motion/views.py:692 #: assignment/views.py:138 motion/views.py:257 motion/views.py:701
#: participant/views.py:506 participant/views.py:529 utils/views.py:225 #: participant/views.py:506 participant/views.py:529 utils/views.py:225
#: utils/views.py:243 utils/views.py:267 #: utils/views.py:243 utils/views.py:267
msgid "Please check the form for errors." msgid "Please check the form for errors."
@ -585,7 +585,7 @@ msgstr "Wahlen: %s"
msgid "Candidates" msgid "Candidates"
msgstr "Kandidaten/innen" msgstr "Kandidaten/innen"
#: assignment/views.py:412 motion/views.py:826 #: assignment/views.py:412 motion/views.py:835
#: motion/templates/motion/view.html:44 #: motion/templates/motion/view.html:44
msgid "Vote results" msgid "Vote results"
msgstr "Abstimmungsergebnis" msgstr "Abstimmungsergebnis"
@ -625,7 +625,7 @@ msgstr "Ungültige Stimmen"
#: assignment/templates/assignment/view.html:202 #: assignment/templates/assignment/view.html:202
#: assignment/templates/assignment/view.html:207 #: assignment/templates/assignment/view.html:207
#: assignment/templates/projector/Assignment.html:109 #: assignment/templates/projector/Assignment.html:109
#: assignment/templates/projector/Assignment.html:115 motion/views.py:833 #: assignment/templates/projector/Assignment.html:115 motion/views.py:842
#: motion/templates/motion/poll_view.html:35 #: motion/templates/motion/poll_view.html:35
#: motion/templates/motion/view.html:84 #: motion/templates/motion/view.html:84
#: motion/templates/projector/Motion.html:42 poll/models.py:76 #: motion/templates/projector/Motion.html:42 poll/models.py:76
@ -660,8 +660,8 @@ msgstr[0] "%d verfügbare Posten"
msgstr[1] "%d verfügbare Posten" msgstr[1] "%d verfügbare Posten"
#: assignment/views.py:580 assignment/templates/assignment/view.html:170 #: assignment/views.py:580 assignment/templates/assignment/view.html:170
#: assignment/templates/projector/Assignment.html:80 motion/views.py:833 #: assignment/templates/projector/Assignment.html:80 motion/views.py:842
#: motion/views.py:886 motion/templates/motion/view.html:81 #: motion/views.py:895 motion/templates/motion/view.html:81
#: motion/templates/projector/Motion.html:39 #: motion/templates/projector/Motion.html:39
msgid "Abstention" msgid "Abstention"
msgstr "Enthaltung" msgstr "Enthaltung"
@ -722,7 +722,7 @@ msgstr "Wahl-Einstellungen"
#: assignment/templates/assignment/overview.html:14 #: assignment/templates/assignment/overview.html:14
#: assignment/templates/assignment/overview.html:27 #: assignment/templates/assignment/overview.html:27
#: assignment/templates/assignment/view.html:11 #: assignment/templates/assignment/view.html:11
#: assignment/templates/projector/Assignment.html:18 motion/views.py:804 #: assignment/templates/projector/Assignment.html:18 motion/views.py:813
#: motion/templates/motion/overview.html:20 #: motion/templates/motion/overview.html:20
#: motion/templates/motion/overview.html:40 #: motion/templates/motion/overview.html:40
#: motion/templates/motion/view.html:34 #: motion/templates/motion/view.html:34
@ -844,7 +844,7 @@ msgid "was not a <br> candidate"
msgstr "war kein Kandidat" msgstr "war kein Kandidat"
#: assignment/templates/assignment/view.html:191 #: assignment/templates/assignment/view.html:191
#: assignment/templates/projector/Assignment.html:100 motion/views.py:833 #: assignment/templates/projector/Assignment.html:100 motion/views.py:842
#: motion/templates/motion/view.html:82 #: motion/templates/motion/view.html:82
#: motion/templates/projector/Motion.html:40 #: motion/templates/projector/Motion.html:40
msgid "Invalid" msgid "Invalid"
@ -904,7 +904,7 @@ msgstr "Allgemein"
#: config/models.py:127 config/templates/config/version.html:5 #: config/models.py:127 config/templates/config/version.html:5
#: config/templates/config/version.html:8 #: config/templates/config/version.html:8
#: config/templates/config/version.html:11 motion/views.py:818 #: config/templates/config/version.html:11 motion/views.py:827
#: motion/templates/motion/view.html:214 motion/templates/motion/view.html:244 #: motion/templates/motion/view.html:214 motion/templates/motion/view.html:244
msgid "Version" msgid "Version"
msgstr "Version" msgstr "Version"
@ -942,7 +942,7 @@ msgstr "Willkommens-Widget"
msgid "System" msgid "System"
msgstr "System" msgstr "System"
#: motion/forms.py:25 motion/models.py:547 motion/views.py:852 #: motion/forms.py:25 motion/models.py:547 motion/views.py:861
#: motion/templates/motion/view.html:229 motion/templates/motion/view.html:249 #: motion/templates/motion/view.html:229 motion/templates/motion/view.html:249
#: motion/templates/projector/Motion.html:77 #: motion/templates/projector/Motion.html:77
msgid "Reason" msgid "Reason"
@ -956,14 +956,14 @@ msgstr "Triviale Änderung"
msgid "Trivial changes don't create a new version." msgid "Trivial changes don't create a new version."
msgstr "Triviale Änderungen erzeugen keine neue Version." msgstr "Triviale Änderungen erzeugen keine neue Version."
#: motion/forms.py:35 motion/models.py:68 motion/views.py:771 #: motion/forms.py:35 motion/models.py:68 motion/views.py:780
#: motion/templates/motion/overview.html:41 #: motion/templates/motion/overview.html:41
#: motion/templates/motion/view.html:18 #: motion/templates/motion/view.html:18
#: motion/templates/projector/Motion.html:55 #: motion/templates/projector/Motion.html:55
msgid "Submitter" msgid "Submitter"
msgstr "Antragsteller/in" msgstr "Antragsteller/in"
#: motion/forms.py:44 motion/views.py:791 motion/templates/motion/view.html:22 #: motion/forms.py:44 motion/views.py:800 motion/templates/motion/view.html:22
msgid "Supporters" msgid "Supporters"
msgstr "Unterstützer/innen" msgstr "Unterstützer/innen"
@ -1182,8 +1182,8 @@ msgstr "Darf Anträge verwalten"
msgid "The assembly may decide," msgid "The assembly may decide,"
msgstr "Die Versammlung möge beschließen," msgstr "Die Versammlung möge beschließen,"
#: motion/models.py:609 motion/views.py:721 motion/views.py:946 #: motion/models.py:609 motion/views.py:730 motion/views.py:955
#: motion/views.py:957 motion/templates/motion/base_motion.html:9 #: motion/views.py:966 motion/templates/motion/base_motion.html:9
#: motion/templates/motion/overview.html:7 #: motion/templates/motion/overview.html:7
#: motion/templates/motion/overview.html:10 #: motion/templates/motion/overview.html:10
msgid "Motions" msgid "Motions"
@ -1330,73 +1330,77 @@ msgstr "FEHLER beim Zurückweisen der Version."
msgid "Do you really want to reject version <b>%s</b>?" msgid "Do you really want to reject version <b>%s</b>?"
msgstr "Soll Version <b>%s</b> wirklich zurückgewiesen werden?" msgstr "Soll Version <b>%s</b> wirklich zurückgewiesen werden?"
#: motion/views.py:600 motion/views.py:604 motion/views.py:610 #: motion/views.py:599 motion/views.py:603 motion/views.py:609
#: motion/views.py:613 participant/api.py:76 #: motion/views.py:612 participant/api.py:76
#, python-format #, python-format
msgid "Ignoring malformed line %d in import file." msgid "Ignoring malformed line %d in import file."
msgstr "Fehlerhafte Zeile %d der Quelldatei wurde ignoriert." msgstr "Fehlerhafte Zeile %d der Quelldatei wurde ignoriert."
#: motion/views.py:621 #: motion/views.py:620
#, python-format #, python-format
msgid "Ignoring line %d because the assigned group may not act as a person." msgid "Ignoring line %d because the assigned group may not act as a person."
msgstr "" msgstr ""
"Fehlerhafte Zeile %d der Quelldatei wurde ignoriert da die verwendete " "Fehlerhafte Zeile %d der Quelldatei wurde ignoriert da die verwendete Gruppe "
"Gruppe nicht als Person auftreten darf." "nicht als Person auftreten darf."
#: motion/views.py:628 #: motion/views.py:629
#, python-format msgid "Created by motion import."
msgid "Ignoring line %d because the assigned group does not exist." msgstr "Erstellt durch Antragsimport."
msgstr ""
"Fehlerhafte Zeile %d der Quelldatei wurde ignoriert da die verwendete "
"Gruppe nicht existiert."
#: motion/views.py:638 #: motion/views.py:643
#, python-format #, python-format
msgid "" msgid ""
"Ignoring line %d because it contains an incomplete first / last name pair." "Ignoring line %d because it contains an incomplete first / last name pair."
msgstr "" msgstr ""
"Fehlerhafte Zeile %d der Quelldatei wurde ignoriert, da Vor- bzw. Nachname" "Fehlerhafte Zeile %d der Quelldatei wurde ignoriert, da Vor- bzw. Nachname "
" Leerstrings enthalten." "Leerstrings enthalten."
#: motion/views.py:676 #: motion/views.py:681
#, python-format #, python-format
msgid "%d motion was successfully imported." msgid "%d motion was successfully imported."
msgid_plural "%d motions were successfully imported." msgid_plural "%d motions were successfully imported."
msgstr[0] "%d Antrag wurde erfolgreich importiert." msgstr[0] "%d Antrag wurde erfolgreich importiert."
msgstr[1] "%d Anträge wurden erfolgreich importiert." msgstr[1] "%d Anträge wurden erfolgreich importiert."
#: motion/views.py:679 #: motion/views.py:684
#, python-format #, python-format
msgid "%d motion was successfully modified." msgid "%d motion was successfully modified."
msgid_plural "%d motions were successfully modified." msgid_plural "%d motions were successfully modified."
msgstr[0] "%d Antrag wurde erfolgreich geändert." msgstr[0] "%d Antrag wurde erfolgreich geändert."
msgstr[1] "%d Anträge wurden erfolgreich geändert." msgstr[1] "%d Anträge wurden erfolgreich geändert."
#: motion/views.py:682 #: motion/views.py:687
#, python-format #, python-format
msgid "%d new user was added." msgid "%d new user was added."
msgid_plural "%d new users were added." msgid_plural "%d new users were added."
msgstr[0] "%d neuer Nutzer wurde erstellt." msgstr[0] "%d neuer Nutzer wurde erstellt."
msgstr[1] "%d neue Nutzer wurden erstellt." msgstr[1] "%d neue Nutzer wurden erstellt."
#: motion/views.py:684 #: motion/views.py:690
#, python-format
msgid "%d new group was added."
msgid_plural "%d new groups were added."
msgstr[0] "%d neue Gruppe wurde erstellt."
msgstr[1] "%d neue Gruppen wurden erstellt."
#: motion/views.py:693
#, python-format #, python-format
msgid "%d group assigned to motions." msgid "%d group assigned to motions."
msgid_plural "%d groups assigned to motions." msgid_plural "%d groups assigned to motions."
msgstr[0] "%d Gruppe wurde zugewiesen." msgstr[0] "%d Gruppe wurde zugewiesen."
msgstr[1] "%d Gruppen wurden zugewiesen." msgstr[1] "%d Gruppen wurden zugewiesen."
#: motion/views.py:688 participant/api.py:92 #: motion/views.py:697 participant/api.py:92
msgid "Import aborted because of severe errors in the input file." msgid "Import aborted because of severe errors in the input file."
msgstr "Import auf Grund von schweren Fehlern in der Quelldatei abgebrochen." msgstr "Import auf Grund von schweren Fehlern in der Quelldatei abgebrochen."
#: motion/views.py:690 participant/api.py:94 #: motion/views.py:699 participant/api.py:94
msgid "Import file has wrong character encoding, only UTF-8 is supported!" msgid "Import file has wrong character encoding, only UTF-8 is supported!"
msgstr "" msgstr ""
"Die Quelldatei benutzt eine ungültige Zeichenkodierung, es wird nur UTF-8 " "Die Quelldatei benutzt eine ungültige Zeichenkodierung, es wird nur UTF-8 "
"wird unterstützt!" "wird unterstützt!"
#: motion/views.py:694 #: motion/views.py:703
msgid "" msgid ""
"Attention: Existing motions will be modified if you import new motions with " "Attention: Existing motions will be modified if you import new motions with "
"the same number." "the same number."
@ -1404,7 +1408,7 @@ msgstr ""
"Achtung: Existierende Anträge werden geändert wenn Sie neue Anträge mit " "Achtung: Existierende Anträge werden geändert wenn Sie neue Anträge mit "
"identischer Nummer importieren." "identischer Nummer importieren."
#: motion/views.py:695 #: motion/views.py:704
msgid "" msgid ""
"Attention: Importing an motions without a number multiple times will create " "Attention: Importing an motions without a number multiple times will create "
"duplicates." "duplicates."
@ -1412,7 +1416,7 @@ msgstr ""
"Achtung: Bei mehrfachem Import eines Antrags ohne Nummer können Duplikate " "Achtung: Bei mehrfachem Import eines Antrags ohne Nummer können Duplikate "
"entstehen." "entstehen."
#: motion/views.py:728 motion/views.py:866 #: motion/views.py:737 motion/views.py:875
#: motion/templates/motion/poll_view.html:7 #: motion/templates/motion/poll_view.html:7
#: motion/templates/motion/poll_view.html:12 #: motion/templates/motion/poll_view.html:12
#: motion/templates/motion/view.html:7 motion/templates/motion/view.html:206 #: motion/templates/motion/view.html:7 motion/templates/motion/view.html:206
@ -1422,21 +1426,21 @@ msgstr ""
msgid "Motion" msgid "Motion"
msgstr "Antrag" msgstr "Antrag"
#: motion/views.py:742 motion/templates/motion/overview.html:84 #: motion/views.py:751 motion/templates/motion/overview.html:84
msgid "No motions available." msgid "No motions available."
msgstr "Keine Anträge vorhanden." msgstr "Keine Anträge vorhanden."
#: motion/views.py:747 motion/views.py:749 motion/views.py:764 #: motion/views.py:756 motion/views.py:758 motion/views.py:773
#: motion/views.py:766 motion/templates/motion/base_motion.html:24 #: motion/views.py:775 motion/templates/motion/base_motion.html:24
#: motion/templates/projector/Motion.html:63 #: motion/templates/projector/Motion.html:63
msgid "Motion No." msgid "Motion No."
msgstr "Antrag Nr." msgstr "Antrag Nr."
#: motion/views.py:781 #: motion/views.py:790
msgid "Signature" msgid "Signature"
msgstr "Unterschrift" msgstr "Unterschrift"
#: motion/views.py:832 motion/templates/motion/base_motion.html:55 #: motion/views.py:841 motion/templates/motion/base_motion.html:55
#: motion/templates/motion/poll_view.html:8 #: motion/templates/motion/poll_view.html:8
#: motion/templates/motion/poll_view.html:13 #: motion/templates/motion/poll_view.html:13
#: motion/templates/motion/view.html:66 motion/templates/motion/view.html:74 #: motion/templates/motion/view.html:66 motion/templates/motion/view.html:74
@ -1444,21 +1448,21 @@ msgstr "Unterschrift"
msgid "Vote" msgid "Vote"
msgstr "Abstimmung" msgstr "Abstimmung"
#: motion/views.py:866 #: motion/views.py:875
msgid "Poll" msgid "Poll"
msgstr "Abstimmung" msgstr "Abstimmung"
#: motion/views.py:880 #: motion/views.py:889
#, python-format #, python-format
msgid "Motion No. %s" msgid "Motion No. %s"
msgstr "Antrag Nr. %s" msgstr "Antrag Nr. %s"
#: motion/views.py:882 #: motion/views.py:891
#, python-format #, python-format
msgid "%d. Vote" msgid "%d. Vote"
msgstr "%d. Abstimmung" msgstr "%d. Abstimmung"
#: motion/views.py:939 #: motion/views.py:948
msgid "Motion settings successfully saved." msgid "Motion settings successfully saved."
msgstr "Antrags-Einstellungen wurden erfolgreich gespeichert." msgstr "Antrags-Einstellungen wurden erfolgreich gespeichert."
@ -1519,8 +1523,9 @@ msgid ""
"code> and <code>is_group</code> are optional and may be empty)" "code> and <code>is_group</code> are optional and may be empty)"
msgstr "" msgstr ""
"Erforderliche kommaseparierte Werte: <code>{Nummer, Titel, Text, Begründung, " "Erforderliche kommaseparierte Werte: <code>{Nummer, Titel, Text, Begründung, "
"Vorname, Nachname, Gruppenantrag}</code> (<code>Nummer</code>, <code>Begründung</code> " "Vorname, Nachname, Gruppenantrag}</code> (<code>Nummer</code>, "
" und <code>Gruppenantrag</code> sind optional und können auch leer sein)" "<code>Begründung</code> und <code>Gruppenantrag</code> sind optional und "
"können auch leer sein)"
#: motion/templates/motion/import.html:13 #: motion/templates/motion/import.html:13
#: participant/templates/participant/import.html:13 #: participant/templates/participant/import.html:13
@ -2381,6 +2386,11 @@ msgstr "undefinierter-dateiname"
msgid "Enter valid JSON" msgid "Enter valid JSON"
msgstr "Gebe valides JSON ein" msgstr "Gebe valides JSON ein"
#~ msgid "Ignoring line %d because the assigned group does not exist."
#~ msgstr ""
#~ "Fehlerhafte Zeile %d der Quelldatei wurde ignoriert da die verwendete "
#~ "Gruppe nicht existiert."
#~ msgid "posts" #~ msgid "posts"
#~ msgstr "Posten" #~ msgstr "Posten"

View File

@ -580,6 +580,7 @@ def motion_import(request):
motions_generated = 0 motions_generated = 0
motions_modified = 0 motions_modified = 0
groups_assigned = 0 groups_assigned = 0
groups_generated = 0
with transaction.commit_on_success(): with transaction.commit_on_success():
dialect = csv.Sniffer().sniff(request.FILES['csvfile'].readline()) dialect = csv.Sniffer().sniff(request.FILES['csvfile'].readline())
dialect = csv_ext.patchup(dialect) dialect = csv_ext.patchup(dialect)
@ -594,9 +595,7 @@ def motion_import(request):
is_group = True is_group = True
else: else:
is_group = False is_group = False
print 'works for %d' % (lno + 1)
except ValueError: except ValueError:
print 'doesn\'t work for %d' % (lno + 1)
messages.error(request, _('Ignoring malformed line %d in import file.') % (lno + 1)) messages.error(request, _('Ignoring malformed line %d in import file.') % (lno + 1))
continue continue
form = MotionForm({'title': title, 'text': text, 'reason': reason}) form = MotionForm({'title': title, 'text': text, 'reason': reason})
@ -625,8 +624,14 @@ def motion_import(request):
groups_assigned += 1 groups_assigned += 1
except Group.DoesNotExist: except Group.DoesNotExist:
messages.error(request, _('Ignoring line %d because the assigned group does not exist.') % (lno + 1)) group = Group()
continue group.group_as_person = True
group.description = _('Created by motion import.')
group.name = last_name
group.save()
groups_generated += 1
user = get_person(group.person_id)
else: else:
# fetch existing users or create new users as needed # fetch existing users or create new users as needed
try: try:
@ -680,6 +685,10 @@ def motion_import(request):
'%d motions were successfully modified.', motions_modified) % motions_modified) '%d motions were successfully modified.', motions_modified) % motions_modified)
if users_generated: if users_generated:
messages.success(request, ungettext('%d new user was added.', '%d new users were added.', users_generated) % users_generated) messages.success(request, ungettext('%d new user was added.', '%d new users were added.', users_generated) % users_generated)
if groups_generated:
messages.success(request, ungettext('%d new group was added.', '%d new groups were added.', groups_generated) % groups_generated)
if groups_assigned: if groups_assigned:
messages.success(request, ungettext('%d group assigned to motions.', '%d groups assigned to motions.', groups_assigned) % groups_assigned) messages.success(request, ungettext('%d group assigned to motions.', '%d groups assigned to motions.', groups_assigned) % groups_assigned)
return redirect(reverse('motion_overview')) return redirect(reverse('motion_overview'))