Skip to content

Commit 0b23701

Browse files
author
Hugo Osvaldo Barrera
authored
Merge pull request #32 from xcodinas/master
Pass writer options in get
2 parents 2c3b785 + 7ab36c9 commit 0b23701

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

barcode/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@
4949
PROVIDED_BARCODES.sort()
5050

5151

52-
def get(name, code=None, writer=None):
52+
def get(name, code=None, writer=None, options=None):
53+
options = options or {}
5354
try:
5455
barcode = __BARCODE_MAP[name.lower()]
5556
except KeyError:
5657
raise BarcodeNotFoundError('The barcode {0!r} you requested is not '
5758
'known.'.format(name))
5859
if code is not None:
59-
return barcode(code, writer)
60+
return barcode(code, writer, **options)
6061
else:
6162
return barcode
6263

@@ -68,7 +69,7 @@ def get_class(name):
6869
def generate(name, code, writer=None, output=None, writer_options=None,
6970
text=None, pil=False):
7071
options = writer_options or {}
71-
barcode = get(name, code, writer)
72+
barcode = get(name, code, writer, options)
7273
if pil:
7374
return barcode.render(writer_options, text)
7475
if isinstance(output, _strbase):

0 commit comments

Comments
 (0)