[damned-lies] Add some more unicode_literals imports



commit e3a11e7da9793c320e31b75a2f3687a3b6c54690
Author: Claude Paroz <claude 2xlibre net>
Date:   Mon Nov 14 22:17:26 2016 +0100

    Add some more unicode_literals imports

 vertimus/models.py      |   13 +++++++------
 vertimus/tests/tests.py |    6 ++++++
 vertimus/views.py       |    1 +
 3 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/vertimus/models.py b/vertimus/models.py
index 326ec26..a190c45 100644
--- a/vertimus/models.py
+++ b/vertimus/models.py
@@ -17,6 +17,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
+from __future__ import unicode_literals
 
 import os, sys
 import shutil
@@ -374,7 +375,7 @@ class ActionAbstract(models.Model):
         abstract = True
 
     def __str__(self):
-        return u"%s (%s) - %s" % (self.name, self.description, self.id)
+        return "%s (%s) - %s" % (self.name, self.description, self.id)
 
     @property
     def description(self):
@@ -426,7 +427,7 @@ class ActionAbstract(models.Model):
 
 class Action(ActionAbstract):
     default_message = ugettext_noop(
-        u"The new state of %(module)s — %(branch)s — %(domain)s (%(language)s) is now “%(new_state)s”.")
+        "The new state of %(module)s — %(branch)s — %(domain)s (%(language)s) is now “%(new_state)s”.")
 
     class Meta:
         db_table = 'action'
@@ -536,9 +537,9 @@ class Action(ActionAbstract):
                 state.branch.name,
                 state.domain.name,
                 state.language.locale)))
-        subject = state.branch.module.name + u' - ' + state.branch.name
+        subject = state.branch.module.name + ' - ' + state.branch.name
         with override(state.language.locale):
-            message = ugettext(u"Hello,") + u"\n\n" + ugettext(self.default_message) + u"\n%(url)s\n\n"
+            message = ugettext("Hello,") + "\n\n" + ugettext(self.default_message) + "\n%(url)s\n\n"
             message = message % {
                 'module': state.branch.module.name,
                 'branch': state.branch.name,
@@ -549,7 +550,7 @@ class Action(ActionAbstract):
             }
             message += self.comment or ugettext("Without comment")
             message += "\n\n" + self.person.name
-            message += "\n--\n" + ugettext(u"This is an automated message sent from %s.") % 
current_site.domain
+            message += "\n--\n" + ugettext("This is an automated message sent from %s.") % 
current_site.domain
         try:
             mail.send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, recipient_list)
         except Exception as exc:
@@ -583,7 +584,7 @@ class ActionWC(Action):
     name = 'WC'
     comment_is_required = True
     default_message = ugettext_noop(
-        u"A new comment has been posted on %(module)s — %(branch)s — %(domain)s (%(language)s).")
+        "A new comment has been posted on %(module)s — %(branch)s — %(domain)s (%(language)s).")
 
     class Meta:
         proxy = True
diff --git a/vertimus/tests/tests.py b/vertimus/tests/tests.py
index 01d089a..2413b17 100644
--- a/vertimus/tests/tests.py
+++ b/vertimus/tests/tests.py
@@ -571,6 +571,12 @@ class VertimusTest(TeamsAndRolesTests):
         response = self.client.get(url)
         self.assertContains(response, '<option value="WC">')
 
+        response = self.client.post(url, data={
+            'action': 'WC',
+            'comment': u'Graçias', 'send_to_ml': '', 'author': str(self.pn.pk)
+        }, follow=True)
+        self.assertContains(response, u'Graçias')
+
     def test_vertimus_view_on_going_activities(self):
         master = Branch(name='master', module=self.m)
         # Block the update of Statistics by the thread
diff --git a/vertimus/views.py b/vertimus/views.py
index 0e44053..a04c9a6 100644
--- a/vertimus/views.py
+++ b/vertimus/views.py
@@ -17,6 +17,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
+from __future__ import unicode_literals
 
 import difflib
 import io


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]