Handle deleted paragraph in milestone anchor
authorThierry Florac <thierry.florac@onf.fr>
Wed, 06 Jun 2018 13:16:18 +0200
changeset 589 7a2af6e086a6
parent 588 fafb10af74b3
child 590 4fafaf94701d
Handle deleted paragraph in milestone anchor
src/pyams_content/component/paragraph/zmi/milestone.py
src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.mo
src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.po
src/pyams_content/locales/pyams_content.pot
--- a/src/pyams_content/component/paragraph/zmi/milestone.py	Wed Jun 06 11:59:32 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/milestone.py	Wed Jun 06 13:16:18 2018 +0200
@@ -280,13 +280,9 @@
             return self.defaultValue
         try:
             vocabulary = getVocabularyRegistry().get(obj, 'PyAMS content paragraphs')
+            return vocabulary.getTermByToken(obj.anchor).title
         except LookupError:
-            paragraph = IParagraphContainer(target).get(obj.anchor)
-            if paragraph is None:
-                return self.defaultValue
-            return II18n(paragraph).query_attribute('title', request=self.request) or self.defaultValue
-        else:
-            return vocabulary.getTermByToken(obj.anchor).title
+            return self.request.localizer.translate(_("(missing paragraph)")).format(obj.anchor)
 
 
 @adapter_config(name='trash', context=(IMilestoneContainerTarget, IPyAMSLayer, MilestonesTable), provides=IColumn)
Binary file src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.mo has changed
--- a/src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.po	Wed Jun 06 11:59:32 2018 +0200
+++ b/src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.po	Wed Jun 06 13:16:18 2018 +0200
@@ -5,7 +5,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-06-06 11:42+0200\n"
+"POT-Creation-Date: 2018-06-06 13:14+0200\n"
 "PO-Revision-Date: 2015-09-10 10:42+0200\n"
 "Last-Translator: Thierry Florac <tflorac@ulthar.net>\n"
 "Language-Team: French\n"
@@ -560,27 +560,31 @@
 msgid "Anchor"
 msgstr "Ancre"
 
-#: src/pyams_content/component/paragraph/zmi/milestone.py:303
+#: src/pyams_content/component/paragraph/zmi/milestone.py:299
 #: src/pyams_content/component/paragraph/interfaces/milestone.py:76
 msgid "Milestones"
 msgstr "Chronologie"
 
-#: src/pyams_content/component/paragraph/zmi/milestone.py:318
+#: src/pyams_content/component/paragraph/zmi/milestone.py:314
 msgid "Add milestone"
 msgstr "Ajouter un jalon"
 
-#: src/pyams_content/component/paragraph/zmi/milestone.py:329
+#: src/pyams_content/component/paragraph/zmi/milestone.py:325
 msgid "Add new milestone"
 msgstr "Ajout d'un jalon"
 
-#: src/pyams_content/component/paragraph/zmi/milestone.py:362
+#: src/pyams_content/component/paragraph/zmi/milestone.py:358
 msgid "Edit milestone properties"
 msgstr "Propriétés du jalon"
 
-#: src/pyams_content/component/paragraph/zmi/milestone.py:351
+#: src/pyams_content/component/paragraph/zmi/milestone.py:347
 msgid "Milestone was correctly added"
 msgstr "Le jalon a été ajouté."
 
+#: src/pyams_content/component/paragraph/zmi/milestone.py:285
+msgid "(missing paragraph)"
+msgstr "(paragraphe supprimé)"
+
 #: src/pyams_content/component/paragraph/zmi/keypoint.py:50
 msgid "Key points..."
 msgstr "Points clés"
@@ -1227,7 +1231,6 @@
 
 #: src/pyams_content/component/paragraph/interfaces/header.py:33
 #: src/pyams_content/component/paragraph/interfaces/header.py:40
-#: src/pyams_content/features/alert/interfaces.py:65
 #: src/pyams_content/features/alert/zmi/container.py:158
 msgid "Header"
 msgstr "Chapô"
@@ -3825,6 +3828,7 @@
 msgstr "Article"
 
 #: src/pyams_content/shared/site/interfaces/__init__.py:58
+#: src/pyams_content/features/alert/interfaces.py:65
 msgid "Heading"
 msgstr "Chapô"
 
@@ -4542,11 +4546,11 @@
 
 #: src/pyams_content/features/alert/interfaces.py:60
 msgid "Alert gravity will affect rendered alert style"
-msgstr "Le niveau de gravité chosi affectera le style de rendu de l'alerte"
+msgstr "Le niveau de gravité choisi affectera le style de rendu de l'alerte"
 
 #: src/pyams_content/features/alert/interfaces.py:66
-msgid "Short alert header"
-msgstr "En-tête de l'alerte"
+msgid "Short alert header (Alert, Important...)"
+msgstr "En-tête de l'alerte (« Alerte », « Important », « Prudence »...)"
 
 #: src/pyams_content/features/alert/interfaces.py:69
 #: src/pyams_content/features/alert/zmi/container.py:170
@@ -4595,7 +4599,7 @@
 "Maximum interval between alert displays on a given device, given in hours; "
 "set to 0 to always display the alert"
 msgstr ""
-"Cet intervalle est donnée en heures ; passé ce délai, pour un internaute "
+"Cet intervalle est donné en heures ; passé ce délai, pour un internaute "
 "donné, l'alerte apparaîtra à nouveau. Si aucun intervalle n'est indiqué, "
 "l'alerte s'affichera en permanence."
 
@@ -4894,9 +4898,6 @@
 #~ msgid "Header paragraph"
 #~ msgstr "Chapô"
 
-#~ msgid "Associations paragraph"
-#~ msgstr "Liens et pièces jointes"
-
 #~ msgid "File legend, as shown in front-office"
 #~ msgstr "Titre du fichier, tel que présenté aux internautes"
 
--- a/src/pyams_content/locales/pyams_content.pot	Wed Jun 06 11:59:32 2018 +0200
+++ b/src/pyams_content/locales/pyams_content.pot	Wed Jun 06 13:16:18 2018 +0200
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE 1.0\n"
-"POT-Creation-Date: 2018-06-06 11:42+0200\n"
+"POT-Creation-Date: 2018-06-06 13:14+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -533,27 +533,31 @@
 msgid "Anchor"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/milestone.py:303
+#: ./src/pyams_content/component/paragraph/zmi/milestone.py:299
 #: ./src/pyams_content/component/paragraph/interfaces/milestone.py:76
 msgid "Milestones"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/milestone.py:318
+#: ./src/pyams_content/component/paragraph/zmi/milestone.py:314
 msgid "Add milestone"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/milestone.py:329
+#: ./src/pyams_content/component/paragraph/zmi/milestone.py:325
 msgid "Add new milestone"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/milestone.py:362
+#: ./src/pyams_content/component/paragraph/zmi/milestone.py:358
 msgid "Edit milestone properties"
 msgstr ""
 
-#: ./src/pyams_content/component/paragraph/zmi/milestone.py:351
+#: ./src/pyams_content/component/paragraph/zmi/milestone.py:347
 msgid "Milestone was correctly added"
 msgstr ""
 
+#: ./src/pyams_content/component/paragraph/zmi/milestone.py:285
+msgid "(missing paragraph)"
+msgstr ""
+
 #: ./src/pyams_content/component/paragraph/zmi/keypoint.py:50
 msgid "Key points..."
 msgstr ""
@@ -1176,7 +1180,6 @@
 
 #: ./src/pyams_content/component/paragraph/interfaces/header.py:33
 #: ./src/pyams_content/component/paragraph/interfaces/header.py:40
-#: ./src/pyams_content/features/alert/interfaces.py:65
 #: ./src/pyams_content/features/alert/zmi/container.py:158
 msgid "Header"
 msgstr ""
@@ -3608,6 +3611,7 @@
 msgstr ""
 
 #: ./src/pyams_content/shared/site/interfaces/__init__.py:58
+#: ./src/pyams_content/features/alert/interfaces.py:65
 msgid "Heading"
 msgstr ""
 
@@ -4319,7 +4323,7 @@
 msgstr ""
 
 #: ./src/pyams_content/features/alert/interfaces.py:66
-msgid "Short alert header"
+msgid "Short alert header (Alert, Important...)"
 msgstr ""
 
 #: ./src/pyams_content/features/alert/interfaces.py:69