[saem-devel] [PATCH 3 of 6] [eac] Improve messages when user can't add authority record because of its settings

Sylvain Thenault sylvain.thenault at logilab.fr
Fri Jan 27 14:50:18 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1485507682 -3600
#      Fri Jan 27 10:01:22 2017 +0100
# Node ID c8692647dfc7a6b4a0f3a3028ac31f4106d4bd43
# Parent  37af40bc48cbfd2ad7ddb20d214d084623bfabfe
[eac] Improve messages when user can't add authority record because of its settings

diff --git a/i18n/en.po b/i18n/en.po
--- a/i18n/en.po
+++ b/i18n/en.po
@@ -91,10 +91,16 @@ msgid "Citation"
 msgstr ""
 
 msgid "Citation_plural"
 msgstr "Citations"
 
+msgid "Edit authority settings"
+msgstr ""
+
+msgid "Edit your settings"
+msgstr ""
+
 msgctxt "inlined:Agent.use_email.subject"
 msgid "EmailAddress"
 msgstr ""
 
 msgid "HierarchicalRelation (child)"
@@ -199,20 +205,15 @@ msgstr ""
 msgid ""
 "You can't add profiles or concept schemes to agent without the 'deposit' "
 "role."
 msgstr ""
 
-#, python-brace-format
-msgid ""
-"You must <a href='{0}'>be in an organization</a> to access this "
-"functionnality."
+msgid "You must be in an organization to access this functionnality."
 msgstr ""
 
-#, python-brace-format
 msgid ""
-"Your organization must <a href='{0}'>have an NAA configured</a> to access "
-"this functionnality."
+"Your organization must have an NAA configured to access this functionnality."
 msgstr ""
 
 msgid "add"
 msgstr ""
 
diff --git a/i18n/fr.po b/i18n/fr.po
--- a/i18n/fr.po
+++ b/i18n/fr.po
@@ -97,10 +97,16 @@ msgid "Citation"
 msgstr ""
 
 msgid "Citation_plural"
 msgstr "Citations"
 
+msgid "Edit authority settings"
+msgstr "Configurer l'autorité administrative"
+
+msgid "Edit your settings"
+msgstr "Éditer votre profil"
+
 msgctxt "inlined:Agent.use_email.subject"
 msgid "EmailAddress"
 msgstr ""
 
 msgid "HierarchicalRelation (child)"
@@ -207,25 +213,19 @@ msgid ""
 "role."
 msgstr ""
 "Vous ne pouvez pas ajouter de vocabulaire ou de profil à un agent qui n'a "
 "pas le rôle 'service versant'."
 
-#, python-brace-format
-msgid ""
-"You must <a href='{0}'>be in an organization</a> to access this "
-"functionnality."
+msgid "You must be in an organization to access this functionnality."
 msgstr ""
-"Vous devez <a href='{0}'>appartenir à une autorité administrative</a> pour "
-"accéder à cette fonctionnalité."
+"Vous devez appartenir à une autorité administrative pour accéder à cette fonctionnalité."
 
-#, python-brace-format
 msgid ""
-"Your organization must <a href='{0}'>have an NAA configured</a> to access "
-"this functionnality."
+"Your organization must have an NAA configured to access this functionnality."
 msgstr ""
-"Votre autorité administrative doit <a href='{0}'>être associée à une "
-"autorité de nommage</a> pour accéder à cette functionnalité."
+"Votre autorité administrative doit être associée à une "
+"autorité de nommage pour accéder à cette functionnalité."
 
 msgid "add"
 msgstr ""
 
 # needed until fix for https://www.cubicweb.org/ticket/5012581 is integrated
diff --git a/views/eac.py b/views/eac.py
--- a/views/eac.py
+++ b/views/eac.py
@@ -50,18 +50,21 @@ class EACImportViewNoNaa(eac.EACImportVi
     __select__ = eac.EACImportView.__select__ & ~user_has_naa()
 
     def call(self):
         self.w(tags.h1(self._cw.__('Importing an AuthorityRecord from a EAC-CPF file')))
         if not self._cw.user.authority:
-            msg = self._cw._("You must <a href='{0}'>be in an organization</a> to access "
-                             "this functionnality.")
-            url = self._cw.user.absolute_url(vid='edition')
+            msg = self._cw._("You must be in an organization to access this functionnality.")
+            msg += " <a href='{}'>{}</a>".format(self._cw.user.absolute_url(vid='edition'),
+                                                 self._cw._('Edit your settings'))
         else:
-            msg = self._cw._("Your organization must <a href='{0}'>have an NAA configured</a> to "
+            msg = self._cw._("Your organization must have an NAA configured to "
                              "access this functionnality.")
-            url = self._cw.user.authority[0].absolute_url(vid='edition')
-        self.w(tags.div(msg.format(url)))
+            authority = self._cw.user.authority[0]
+            if authority.cw_has_perm('update'):
+                msg += " <a href='{}'>{}</a>".format(authority.absolute_url(vid='edition'),
+                                                     self._cw._('Edit authority settings'))
+        self.w(tags.div(msg))
 
 
 def registration_callback(vreg):
     vreg.register_all(globals().values(), __name__, (EACImportForm, EACImportView))
     vreg.register_and_replace(EACImportForm, eac.EACImportForm)


More information about the saem-devel mailing list