[after edition ui] closes #1381425: Wrong message : 'entity edited (click here to see created entity)' stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 21 Jan 2011 12:03:07 +0100
branchstable
changeset 6866 51d7868264b1
parent 6865 89ecbae8f9be
child 6867 f691757792f9
[after edition ui] closes #1381425: Wrong message : 'entity edited (click here to see created entity)'
i18n/de.po
i18n/en.po
i18n/es.po
i18n/fr.po
web/controller.py
--- a/i18n/de.po	Fri Jan 21 12:02:36 2011 +0100
+++ b/i18n/de.po	Fri Jan 21 12:03:07 2011 +0100
@@ -1360,6 +1360,9 @@
 msgid "click here to see created entity"
 msgstr "Hier klicken, um die angelegte Entität anzusehen"
 
+msgid "click here to see edited entity"
+msgstr ""
+
 msgid "click on the box to cancel the deletion"
 msgstr "Klicken Sie die Box an, um das Löschen rückgängig zu machen."
 
--- a/i18n/en.po	Fri Jan 21 12:02:36 2011 +0100
+++ b/i18n/en.po	Fri Jan 21 12:03:07 2011 +0100
@@ -1312,6 +1312,9 @@
 msgid "click here to see created entity"
 msgstr ""
 
+msgid "click here to see edited entity"
+msgstr ""
+
 msgid "click on the box to cancel the deletion"
 msgstr ""
 
--- a/i18n/es.po	Fri Jan 21 12:02:36 2011 +0100
+++ b/i18n/es.po	Fri Jan 21 12:03:07 2011 +0100
@@ -1360,6 +1360,9 @@
 msgid "click here to see created entity"
 msgstr "Ver la entidad creada"
 
+msgid "click here to see edited entity"
+msgstr ""
+
 msgid "click on the box to cancel the deletion"
 msgstr "Seleccione la zona de edición para cancelar la eliminación"
 
--- a/i18n/fr.po	Fri Jan 21 12:02:36 2011 +0100
+++ b/i18n/fr.po	Fri Jan 21 12:03:07 2011 +0100
@@ -1362,6 +1362,9 @@
 msgid "click here to see created entity"
 msgstr "cliquez ici pour voir l'entité créée"
 
+msgid "click here to see edited entity"
+msgstr "cliquez ici pour voir l'entité modifiée"
+
 msgid "click on the box to cancel the deletion"
 msgstr "cliquez dans la zone d'édition pour annuler la suppression"
 
--- a/web/controller.py	Fri Jan 21 12:02:36 2011 +0100
+++ b/web/controller.py	Fri Jan 21 12:03:07 2011 +0100
@@ -148,10 +148,13 @@
             path = self._cw.form['__redirectpath']
             if (self._edited_entity and path != self._edited_entity.rest_path()
                 and '_cwmsgid' in newparams):
-                # XXX may be here on modification?
-                msg = u'(<a href="%s">%s</a>)' % (
-                    xml_escape(self._edited_entity.absolute_url()),
-                    self._cw._('click here to see created entity'))
+                # are we here on creation or modification?
+                if any(eid == self._edited_entity.eid
+                       for eid in self._cw.data.get('eidmap', {}).values()):
+                    msg = self._cw._('click here to see created entity')
+                else:
+                    msg = self._cw._('click here to see edited entity')
+                msg = u'(<a href="%s">%s</a>)' % (xml_escape(self._edited_entity.absolute_url()), msg)
                 self._cw.append_to_redirect_message(msg)
         elif self._after_deletion_path:
             # else it should have been set during form processing