empty string has the same effect: will not be found --> None

This commit is contained in:
Patrick Kanzler 2023-09-04 01:08:08 +02:00
parent a828d8b9ef
commit d8815b212a

View File

@ -572,14 +572,14 @@ class Escpos(object):
def _hw_barcode( def _hw_barcode(
self, self,
code, code: str,
bc: str, bc: str,
height: int = 64, height: int = 64,
width: int = 3, width: int = 3,
pos: str = "BELOW", pos: str = "BELOW",
font: str = "A", font: str = "A",
align_ct: bool = True, align_ct: bool = True,
function_type=None, function_type: Optional[str] = None,
check: bool = True, check: bool = True,
) -> None: ) -> None:
"""Print Barcode. """Print Barcode.
@ -661,7 +661,7 @@ class Escpos(object):
""" """
# If function_type is specified, otherwise use guessing. # If function_type is specified, otherwise use guessing.
ft_guess = [ft for ft in ["A", "B"] if bc in BARCODE_TYPES.get(ft, {"": b""})] ft_guess = [ft for ft in ["A", "B"] if bc in BARCODE_TYPES.get(ft, {"": b""})]
ft_guess = ft_guess or [None] ft_guess = ft_guess or [""]
function_type = function_type or ft_guess[0] function_type = function_type or ft_guess[0]
if not function_type or not BARCODE_TYPES.get(function_type.upper()): if not function_type or not BARCODE_TYPES.get(function_type.upper()):