403Webshell
Server IP : 82.208.35.60  /  Your IP : 216.73.216.89
Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31
System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64
User : studiokobylisy_cz ( 1008)
PHP Version : 7.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/ports/textproc/itstool/files/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/ports/textproc/itstool/files/patch-itstool.in
# Workaround https://github.com/itstool/itstool/issues/25
# Obtained from Fedora

--- itstool.in.orig	2018-08-21 15:27:24 UTC
+++ itstool.in
@@ -44,9 +44,22 @@ if PY3:
         else:
             return str(s)
     ustr_type = str
+    def pr_str(s):
+        """Return a string that can be safely print()ed"""
+        # Since print works on both bytes and unicode, just return the argument
+        return s
 else:
     string_types = basestring,
     ustr = ustr_type = unicode
+    def pr_str(s):
+        """Return a string that can be safely print()ed"""
+        if isinstance(s, str):
+            # Since print works on str, just return the argument
+            return s
+        else:
+            # print may not work on unicode if the output encoding cannot be
+            # detected, so just encode with UTF-8
+            return unicode.encode(s, 'utf-8')
 
 NS_ITS = 'http://www.w3.org/2005/11/its'
 NS_ITST = 'http://itstool.org/extensions/'
@@ -1060,9 +1073,9 @@ class Document (object):
             if strict:
                 raise
             else:
-                sys.stderr.write('Warning: Could not merge %stranslation for msgid:\n%s\n' % (
+                sys.stderr.write(pr_str('Warning: Could not merge %stranslation for msgid:\n%s\n' % (
                         (lang + ' ') if lang is not None else '',
-                        msgstr.encode('utf-8')))
+                        msgstr)))
                 self._xml_err = ''
                 return node
         def scan_node(node):
@@ -1087,9 +1100,9 @@ class Document (object):
             if strict:
                 raise
             else:
-                sys.stderr.write('Warning: Could not merge %stranslation for msgid:\n%s\n' % (
+                sys.stderr.write(pr_str('Warning: Could not merge %stranslation for msgid:\n%s\n' % (
                     (lang + ' ') if lang is not None else '',
-                    msgstr.encode('utf-8')))
+                    msgstr)))
                 self._xml_err = ''
                 ctxt.doc().freeDoc()
                 return node

Youez - 2016 - github.com/yon3zu
LinuXploit