comparison Plugins/WebDav/Run.py @ 610:ec657d1a62a6 Orthanc-1.12.3

fix compatibility with python3
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 31 Jan 2024 12:18:20 +0100
parents 933fe1bbce4f
children 7a9d5186b51b
comparison
equal deleted inserted replaced
609:a8e49d30f634 610:ec657d1a62a6
1 #!/usr/bin/python 1 #!/usr/bin/python3
2 2
3 # Orthanc - A Lightweight, RESTful DICOM Store 3 # Orthanc - A Lightweight, RESTful DICOM Store
4 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics 4 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
5 # Department, University Hospital of Liege, Belgium 5 # Department, University Hospital of Liege, Belgium
6 # Copyright (C) 2017-2023 Osimis S.A., Belgium 6 # Copyright (C) 2017-2023 Osimis S.A., Belgium
413 WEBDAV.delete(p) 413 WEBDAV.delete(p)
414 self.assertEqual(0, len(DoGet(ORTHANC, '/instances'))) 414 self.assertEqual(0, len(DoGet(ORTHANC, '/instances')))
415 415
416 416
417 def test_upload_zip(self): 417 def test_upload_zip(self):
418 f = StringIO() 418 f = BytesIO()
419 with zipfile.ZipFile(f, 'w') as z: 419 with zipfile.ZipFile(f, 'w') as z:
420 z.writestr('hello/world/invalid.txt', 'Hello world') 420 z.writestr('hello/world/invalid.txt', 'Hello world')
421 with open(GetDatabasePath('DummyCT.dcm'), 'rb') as g: 421 with open(GetDatabasePath('DummyCT.dcm'), 'rb') as g:
422 c = g.read() 422 c = g.read()
423 z.writestr('hello/world/dicom1.dcm', c) 423 z.writestr('hello/world/dicom1.dcm', c)