[damned-lies] Remove or rename force_text



commit 88e92059c77045461479a2b10b5de838eb306c9f
Author: Claude Paroz <claude 2xlibre net>
Date:   Wed Dec 4 14:19:37 2019 +0100

    Remove or rename force_text

 stats/admin.py  | 3 +--
 stats/doap.py   | 4 +---
 stats/models.py | 6 +++---
 stats/utils.py  | 3 +--
 4 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/stats/admin.py b/stats/admin.py
index 084c41d4..bbe78dd7 100644
--- a/stats/admin.py
+++ b/stats/admin.py
@@ -5,7 +5,6 @@ from django.contrib.admin import helpers
 from django.db import transaction
 from django.http import HttpResponseRedirect
 from django.shortcuts import render
-from django.utils.encoding import force_text
 
 from stats.models import (
     Statistics, Information, PoFile, Module, Branch, Domain, Category,
@@ -181,7 +180,7 @@ class ReleaseAdmin(admin.ModelAdmin):
         if request.POST.get('post'):
             # Already confirmed
             for obj in queryset:
-                self.log_deletion(request, obj, force_text(obj))
+                self.log_deletion(request, obj, str(obj))
             n = queryset.count()
             b = 0
             for release in queryset:
diff --git a/stats/doap.py b/stats/doap.py
index e60abb8c..70f57b2b 100644
--- a/stats/doap.py
+++ b/stats/doap.py
@@ -2,8 +2,6 @@ import re
 from urllib.parse import unquote
 from xml.etree.ElementTree import ParseError, parse
 
-from django.utils.encoding import force_text
-
 from people.models import Person
 
 
@@ -60,7 +58,7 @@ def update_doap_infos(module):
 
     # *********** Update maintainers
     def slugify(val):
-        value = force_text(re.sub('[^\w\s-]', '', val).strip().lower())
+        value = re.sub('[^\w\s-]', '', val).strip().lower()
         return re.sub('[-\s]+', '-', value)
     doap_maintainers = tree.parse_maintainers()
     current_maintainers = dict([(m.email or m.username, m) for m in module.maintainers.all()])
diff --git a/stats/models.py b/stats/models.py
index ffc81de8..ffe132ce 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -16,7 +16,7 @@ from django.core.exceptions import ValidationError
 from django.core.management import call_command
 from django.core.validators import RegexValidator
 from django.urls import reverse
-from django.utils.encoding import force_text
+from django.utils.encoding import force_str
 from django.utils.functional import cached_property
 from django.utils.translation import ngettext, gettext as _, gettext_noop
 from django.utils import dateformat
@@ -589,7 +589,7 @@ class Branch(models.Model):
                 stat.update_stats(dest_full_path)
         else:
             self.update_stats(force=False, checkout=False, domain=domain)
-        return force_text(commit_hash)
+        return force_str(commit_hash)
 
     def cherrypick_commit(self, commit_hash, domain):
         """
@@ -781,7 +781,7 @@ class Domain(models.Model):
                      gettext_noop("Error regenerating POT file for 
%(file)s:\n<pre>%(cmd)s\n%(output)s</pre>") % {
                         'file': self.potbase(),
                         'cmd': ' '.join(pot_command) if isinstance(pot_command, list) else pot_command,
-                        'output': force_text(errs)
+                        'output': force_str(errs)
                     }),
                 )
             if not potfile.exists():
diff --git a/stats/utils.py b/stats/utils.py
index 2c0d47a3..8f3cfa2a 100644
--- a/stats/utils.py
+++ b/stats/utils.py
@@ -13,7 +13,6 @@ from translate.tools import pogrep, pocount
 from django.conf import settings
 from django.core.files.base import File
 from django.template.loader import get_template
-from django.utils.encoding import force_text
 from django.utils.functional import cached_property
 from django.utils.translation import gettext as _, gettext_noop
 
@@ -767,7 +766,7 @@ def notify_list(branch, diff):
     text = template.render({
         'module': '%s.%s' % (branch.module.name, branch.name),
         'ourweb': settings.SITE_DOMAIN,
-        'potdiff': force_text("\n    ".join(diff)),
+        'potdiff': "\n    ".join(diff),
         'commit_log': branch.get_vcs_web_log_url(),
     })
     send_mail("String additions to '%s.%s'" % (branch.module.name, branch.name),


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