[LyX/master] ePub: use None instead of an empty string.

Thibaut Cuvelier tcuvelier at lyx.org
Sun Feb 7 19:49:56 UTC 2021


commit bf976cb0aea0e3699fa1b2f4596e12f7e38114eb
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sun Feb 7 20:52:50 2021 +0100

    ePub: use None instead of an empty string.
---
 lib/scripts/docbook2epub.py |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/scripts/docbook2epub.py b/lib/scripts/docbook2epub.py
index b3aba7a..35eda89 100644
--- a/lib/scripts/docbook2epub.py
+++ b/lib/scripts/docbook2epub.py
@@ -31,9 +31,9 @@ class DocBookToEpub:
             sys.exit(1)
 
         self.own_path = sys.argv[0]
-        self.java_path = sys.argv[1] if sys.argv[1] != '' and sys.argv[1] != 'none' else ''
-        self.xsltproc_path = sys.argv[2] if sys.argv[2] != '' and sys.argv[2] != 'none' else ''
-        self.xslt_path = sys.argv[3] if sys.argv[3] != '' and sys.argv[3] != 'none' else ''
+        self.java_path = sys.argv[1] if sys.argv[1] != '' and sys.argv[1] != 'none' else None
+        self.xsltproc_path = sys.argv[2] if sys.argv[2] != '' and sys.argv[2] != 'none' else None
+        self.xslt_path = sys.argv[3] if sys.argv[3] != '' and sys.argv[3] != 'none' else None
         self.input = sys.argv[4]
         self.output = sys.argv[5]
         self.script_folder = os.path.dirname(self.own_path) + '/../'
@@ -50,7 +50,7 @@ class DocBookToEpub:
         self.package_opf = self.output_dir + '/OEBPS/package.opf'  # Does not exist yet,
         print('Temporary output directory: %s' % self.output_dir)
 
-        if self.xslt_path == '':
+        if self.xslt_path is None:
             self.xslt = self.script_folder + 'docbook/epub3/chunk.xsl'
         else:
             self.xslt = self.xslt_path + '/epub3/chunk.xsl'
@@ -67,9 +67,9 @@ class DocBookToEpub:
 
     def start_xslt_transformation(self):
         command = None
-        if self.xsltproc_path != '':
+        if self.xsltproc_path is not None:
             command = self.start_xslt_transformation_xsltproc()
-        elif self.java_path != '':
+        elif self.java_path is not None:
             command = self.start_xslt_transformation_saxon6()
 
         if command is None:


More information about the lyx-cvs mailing list