File: py3.diff

package info (click to toggle)
dico 2.12-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 21,236 kB
  • sloc: ansic: 94,671; sh: 52,520; lex: 4,023; yacc: 1,439; tcl: 1,439; makefile: 1,387; python: 1,310; perl: 1,200; lisp: 489; awk: 157; pascal: 127; javascript: 71; cpp: 50; fortran: 28; asm: 21; sed: 16; xml: 8
file content (58 lines) | stat: -rw-r--r-- 2,337 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Description: fix python3 compatibility
Author: "Marc Dequènes (duck)" <duck@debian.org>
Forwarded: yes
Index: dico/dicoweb/views.py
===================================================================
--- dico.orig/dicoweb/views.py	2025-01-02 14:46:53.532348747 +0100
+++ dico/dicoweb/views.py	2025-01-02 14:46:53.532348747 +0100
@@ -32,7 +32,7 @@
 from django.utils.translation import gettext as _
 from django.utils.html import escape
 
-from .dicoclient import dicoclient
+import dicoclient
 try:
     from wikitrans import wiki2html
 except ImportError:
Index: dico/app/python/mediawiki.py
===================================================================
--- dico.orig/app/python/mediawiki.py	2025-01-02 14:46:53.532348747 +0100
+++ dico/app/python/mediawiki.py	2025-01-02 14:46:53.532348747 +0100
@@ -108,7 +108,7 @@
         req = Request (url)
         req.add_header ('User-Agent', self.user_agent)
         try:
-            result = json.load (urlopen (req))
+            result = json.loads(urlopen(req).read().decode('utf8'))
             if result:
                 if strat.has_selector:
                     fltres = []
@@ -116,10 +116,10 @@
                         if strat.select (k, key):
                             fltres.append (k)
                     if len(fltres) > 0:
-                        return ['match', sorted(fltres, key=unicode.lower)]
+                        return ['match', sorted(fltres, key=str.lower)]
                 else:
                     result[1].sort ()
-                    return ['match', sorted(result[1], key=unicode.lower)]
+                    return ['match', sorted(result[1], key=str.lower)]
             return False
         except URLError:
             return False
@@ -158,4 +158,4 @@
 
     def __htmlentitydecode (self, s):
         return re.sub ('&(%s);' % '|'.join (name2codepoint),
-                       lambda m: unichr (name2codepoint[m.group (1)]), s)
+                       lambda m: chr (name2codepoint[m.group (1)]), s)
Index: dico/dicoweb/manage.py
===================================================================
--- dico.orig/dicoweb/manage.py	2025-01-02 14:46:53.532348747 +0100
+++ dico/dicoweb/manage.py	2025-01-02 14:46:53.532348747 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 
 """
 #  This file is part of GNU Dico.