You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2021/01/08 20:27:03 UTC

[allura] branch db/py3_more_fixes created (now 07f998b)

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a change to branch db/py3_more_fixes
in repository https://gitbox.apache.org/repos/asf/allura.git.


      at 07f998b  py3: ensure unicode before all markup handling paths here

This branch includes the following new commits:

     new 0f17930  py3: encoding fixes in some less common commands
     new 07f998b  py3: ensure unicode before all markup handling paths here

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[allura] 01/02: py3: encoding fixes in some less common commands

Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch db/py3_more_fixes
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 0f1793085a7831cbb33cbbf253e53b918b163b73
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Thu Jan 7 16:25:31 2021 -0500

    py3: encoding fixes in some less common commands
---
 Allura/allura/command/taskd_cleanup.py | 5 +++--
 ForgeChat/forgechat/command.py         | 8 +++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Allura/allura/command/taskd_cleanup.py b/Allura/allura/command/taskd_cleanup.py
index 5523410..43ee799 100644
--- a/Allura/allura/command/taskd_cleanup.py
+++ b/Allura/allura/command/taskd_cleanup.py
@@ -23,6 +23,7 @@ import signal
 import socket
 import subprocess
 from ming.orm.ormsession import ThreadLocalORMSession
+import six
 
 from allura import model as M
 from . import base
@@ -138,7 +139,7 @@ class TaskdCleanupCommand(base.Command):
         stdout, stderr = p.communicate()
         tasks = []
         if p.returncode == 0:
-            tasks = [pid for pid in stdout.split('\n') if pid != '']
+            tasks = [pid for pid in six.ensure_text(stdout).split('\n') if pid != '']
         return tasks
 
     def _taskd_status(self, pid, retry=False):
@@ -152,7 +153,7 @@ class TaskdCleanupCommand(base.Command):
             base.log.error('Can\'t read taskd status log %s' %
                            self.taskd_status_log)
             exit(1)
-        return stdout
+        return six.ensure_text(stdout)
 
     def _check_taskd_status(self, pid):
         for i in range(self.options.num_retry):
diff --git a/ForgeChat/forgechat/command.py b/ForgeChat/forgechat/command.py
index 6c9c0c8..78858b5 100644
--- a/ForgeChat/forgechat/command.py
+++ b/ForgeChat/forgechat/command.py
@@ -17,6 +17,8 @@
 
 from __future__ import unicode_literals
 from __future__ import absolute_import
+
+import six
 import time
 import logging
 import socket
@@ -79,7 +81,7 @@ class IRCBot(asynchat.async_chat):
         sock = socket.socket()
         sock.connect((host, port))
         asynchat.async_chat.__init__(self, sock)
-        self.set_terminator('\r\n')
+        self.set_terminator(b'\r\n')
         self.data = []
         self.channels = {}
         self.set_nick('000')
@@ -95,7 +97,7 @@ class IRCBot(asynchat.async_chat):
         self.say('NICK ' + nick)
 
     def collect_incoming_data(self, data):
-        self.data.append(data)
+        self.data.append(six.ensure_text(data))
 
     def found_terminator(self):
         request = ''.join(self.data)
@@ -129,7 +131,7 @@ class IRCBot(asynchat.async_chat):
     def say(self, s):
         s = s.encode('utf-8')
         self.logger.debug('SAYING %s', s)
-        self.push(s + '\r\n')
+        self.push(s + b'\r\n')
 
     def notice(self, out, message):
         self.say('NOTICE %s :%s' % (out, message))


[allura] 02/02: py3: ensure unicode before all markup handling paths here

Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch db/py3_more_fixes
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 07f998becccee8b10ecb85a02177a69167fbbe24
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Fri Jan 8 15:26:39 2021 -0500

    py3: ensure unicode before all markup handling paths here
---
 Allura/allura/lib/helpers.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index 8773279..8a526b6 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -763,7 +763,7 @@ TABLE = 'table'
 
 def render_any_markup(name, txt, code_mode=False, linenumbers_style=TABLE):
     """
-    renders markdown using allura enhacements if file is in markdown format
+    renders markdown using allura enhancements if file is in markdown format
     renders any other markup format using the pypeline
     Returns jinja-safe text
     """
@@ -771,8 +771,9 @@ def render_any_markup(name, txt, code_mode=False, linenumbers_style=TABLE):
         txt = '<p><em>Empty File</em></p>'
     else:
         fmt = g.pypeline_markup.can_render(name)
+        txt = really_unicode(txt)
         if fmt == 'markdown':
-            txt = g.markdown.convert(really_unicode(txt))
+            txt = g.markdown.convert(txt)
         else:
             txt = g.pypeline_markup.render(name, txt)
         if not fmt: