[Testbot] Plone 4.3 - Python 2.7 - Build # 2704 - Regression! - 1 failure(s)

jenkins at plone.org jenkins at plone.org
Wed Oct 29 12:30:35 UTC 2014


-------------------------------------------------------------------------------
Plone 4.3 - Python 2.7 - Build # 2704 - Failure!
-------------------------------------------------------------------------------

http://jenkins.plone.org/job/plone-4.3-python-2.7/2704/


-------------------------------------------------------------------------------
CHANGES
-------------------------------------------------------------------------------

Repository: Products.TinyMCE
Branch: refs/heads/1.3.x
Date: 2014-10-29T12:54:06+01:00
Author: Vincent Fretin (vincentfretin) <vincent.fretin at gmail.com>
Commit: https://github.com/plone/Products.TinyMCE/commit/923129f3b7055663ce9e2fe246a14366c09ede90

Fix i18n of upload error messages

Files changed:
M HISTORY.rst
M Products/TinyMCE/adapters/Upload.py

diff --git a/HISTORY.rst b/HISTORY.rst
index bac7ef7..bc6dbd6 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -5,7 +5,8 @@ HISTORY
 1.3.8 (unreleased)
 ------------------
 
-- Nothing changed yet.
+- Fix i18n of upload error messages.
+  [vincentfretin]
 
 
 1.3.7 (2014-09-11)
diff --git a/Products/TinyMCE/adapters/Upload.py b/Products/TinyMCE/adapters/Upload.py
index 0cea8ea..ec771a6 100644
--- a/Products/TinyMCE/adapters/Upload.py
+++ b/Products/TinyMCE/adapters/Upload.py
@@ -2,6 +2,7 @@
 from Acquisition import aq_parent
 from zExceptions import BadRequest
 from zope.app.content import queryContentType
+from zope.i18n import translate
 from zope.schema import getFieldsInOrder
 from Products.CMFCore.interfaces._content import IFolderish
 from Products.CMFCore.utils import getToolByName
@@ -44,6 +45,7 @@ def __init__(self, context):
 
     def errorMessage(self, msg):
         """Returns an error message"""
+        msg = translate(msg, context=self.context.REQUEST)
         script = TEMPLATE % (
             "window.parent.uploadError('" + msg.replace("'", "\\'") + "');")
         return script
@@ -108,7 +110,7 @@ def upload(self):
         if not context.portal_membership.checkPermission(
             'Add portal content', context):
             return self.errorMessage(
-                "You do not have permission to upload files in this folder")
+                _("You do not have permission to upload files in this folder"))
 
         # 2) check image types uploadable in folder.
         #    priority is to content_type_registry image type
@@ -164,14 +166,15 @@ def upload(self):
         if HAS_DEXTERITY and IDexterityContent.providedBy(obj):
             if not self.setDexterityItem(obj, uploadfile):
                 return self.errorMessage(
-                    _("The content-type '%s' has no blob-field!" % metatype))
+                        _("The content-type '${type}' has no blob-field!",
+                          mapping={'type': metatype}))
         else:
             # set primary field
             pf = obj.getPrimaryField()
             pf.set(obj, uploadfile)
 
         if not obj:
-            return self.errorMessage("Could not upload the file")
+            return self.errorMessage(_("Could not upload the file"))
 
         obj.reindexObject()
         folder = obj.aq_parent.absolute_url()




-------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CHANGES.log
Type: application/octet-stream
Size: 2708 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-testbot/attachments/20141029/119ae5a6/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.log
Type: application/octet-stream
Size: 87818 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-testbot/attachments/20141029/119ae5a6/attachment-0003.obj>


More information about the Testbot mailing list