File: new_reportlab_API_PR590.patch

package info (click to toggle)
xhtml2pdf 0.2.5-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,952 kB
  • sloc: python: 10,482; makefile: 242; xml: 24
file content (39 lines) | stat: -rw-r--r-- 1,909 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
From 7627296bdbab4cbd81ca91d655a9605f6630664f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?An=C5=BEe=20Pe=C4=8Dar?= <anze@pecar.me>
Date: Fri, 18 Feb 2022 15:44:13 +0000
Subject: [PATCH] Remove usage of getStringIO

reportlab 3.6.7 removed getStringIO and getByteIO: https://github.com/MrBitBucket/reportlab-mirror/commit/684d21e2da8f835ca3670e78cc9a011ba71a7e9a

This should resolve: Cannot import name 'getStringIO' from 'reportlab.lib.utils'  #589
---
 xhtml2pdf/xhtml2pdf_reportlab.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: xhtml2pdf/xhtml2pdf/xhtml2pdf_reportlab.py
===================================================================
--- xhtml2pdf.orig/xhtml2pdf/xhtml2pdf_reportlab.py	2022-04-07 17:50:14.049992746 +0200
+++ xhtml2pdf/xhtml2pdf/xhtml2pdf_reportlab.py	2022-04-07 17:51:46.190768115 +0200
@@ -14,10 +14,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from io import StringIO
+
 from hashlib import md5
 from reportlab.lib.enums import TA_RIGHT
 from reportlab.lib.styles import ParagraphStyle
-from reportlab.lib.utils import flatten, open_for_read, getStringIO, \
+from reportlab.lib.utils import flatten, open_for_read, \
     LazyImageReader, haveImages
 from reportlab.platypus.doctemplate import BaseDocTemplate, PageTemplate, IndexingFlowable
 from reportlab.platypus.flowables import Flowable, CondPageBreak, \
@@ -338,7 +340,7 @@
                             register_reset(self._cache.clear)
 
                         data = self._cache.setdefault(md5(data).digest(), data)
-                    self.fp = getStringIO(data)
+                    self.fp = StringIO(data)
                 elif imageReaderFlags == - 1 and isinstance(fileName, six.text_type):
                     #try Ralf Schmitt's re-opening technique of avoiding too many open files
                     self.fp.close()