From fc0a860e9b1348b27a5dfab100d35d7bf2c5671a Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 15 Jul 2024 13:54:29 +1000 Subject: [PATCH] Fix argument name (#7653) * Fix argument name * Fix typo --- docs/docs/stock/stock.md | 2 +- src/backend/InvenTree/report/helpers.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/docs/stock/stock.md b/docs/docs/stock/stock.md index c21fe52a9a..8e9690b5ec 100644 --- a/docs/docs/stock/stock.md +++ b/docs/docs/stock/stock.md @@ -8,7 +8,7 @@ A stock location represents a physical real-world location where *Stock Items* a ## Stock Location Type -A stock location type represents a specific type of location (e.g. one specifc size of drawer, shelf, ... or box) which can be assigned to multiple stock locations. In the first place, it is used to specify an icon and having the icon in sync for all locations that use this location type, but it also serves as a data field to quickly see what type of location this is. It is planned to add e.g. drawer dimension information to the location type to add a "find a matching, empty stock location" tool. +A stock location type represents a specific type of location (e.g. one specific size of drawer, shelf, ... or box) which can be assigned to multiple stock locations. In the first place, it is used to specify an icon and having the icon in sync for all locations that use this location type, but it also serves as a data field to quickly see what type of location this is. It is planned to add e.g. drawer dimension information to the location type to add a "find a matching, empty stock location" tool. ## Stock Item diff --git a/src/backend/InvenTree/report/helpers.py b/src/backend/InvenTree/report/helpers.py index 8dcb196024..04e328da8a 100644 --- a/src/backend/InvenTree/report/helpers.py +++ b/src/backend/InvenTree/report/helpers.py @@ -78,21 +78,21 @@ def report_page_size_default(): return page_size -def encode_image_base64(image, format: str = 'PNG'): +def encode_image_base64(image, img_format: str = 'PNG'): """Return a base-64 encoded image which can be rendered in an tag. Arguments: image: {Image} -- Image to encode - format: {str} -- Image format (default = 'PNG') + img_format: {str} -- Image format (default = 'PNG') Returns: str -- Base64 encoded image data e.g. 'data:image/png;base64,xxxxxxxxx' """ - fmt = format.lower() + img_format = str(img_format).lower() buffered = io.BytesIO() - image.save(buffered, fmt) + image.save(buffered, img_format) img_str = base64.b64encode(buffered.getvalue()) - return f'data:image/{fmt};charset=utf-8;base64,' + img_str.decode() + return f'data:image/{img_format};charset=utf-8;base64,' + img_str.decode()