[BoM][Fixed] The length of the CSV separator is now validated.

This commit is contained in:
Salvador E. Tropea 2022-11-23 20:54:58 -03:00
parent 8028fb27e1
commit be68daace1
4 changed files with 11 additions and 2 deletions

View File

@ -56,6 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- BoM: Digi-key link in the HTML output.
- Problems when using more than one dielectric in the stack-up. (#328)
- Gerber: Extension used for JLCPCB inner layers. (#329)
- BoM: The length of the CSV separator is now validated.
## [1.4.0] - 2022-10-12
### Added

View File

@ -1435,6 +1435,7 @@ Notes:
* Valid keys:
- **`quote_all`**: [boolean=false] Enclose all values using double quotes.
- **`separator`**: [string=','] CSV Separator. TXT and TSV always use tab as delimiter.
Only one character can be specified.
- `hide_header`: [boolean=false] Hide the header line (names of the columns).
- `hide_pcb_info`: [boolean=false] Hide project information.
- `hide_stats_info`: [boolean=false] Hide statistics information.

View File

@ -210,7 +210,8 @@ outputs:
hide_stats_info: false
# [boolean=false] Enclose all values using double quotes
quote_all: false
# [string=','] CSV Separator. TXT and TSV always use tab as delimiter
# [string=','] CSV Separator. TXT and TSV always use tab as delimiter.
# Only one character can be specified
separator: ','
# [string|list(string)] Include this distributors list. Default is all the available
distributors:

View File

@ -247,7 +247,8 @@ class BoMCSV(Optionable):
super().__init__()
with document:
self.separator = ','
""" *CSV Separator. TXT and TSV always use tab as delimiter """
""" *CSV Separator. TXT and TSV always use tab as delimiter.
Only one character can be specified """
self.hide_header = False
""" Hide the header line (names of the columns) """
self.hide_pcb_info = False
@ -257,6 +258,11 @@ class BoMCSV(Optionable):
self.quote_all = False
""" *Enclose all values using double quotes """
def config(self, parent):
super().config(parent)
if len(self.separator) != 1:
raise KiPlotConfigurationError('The CSV separator must be one character (`{}`)'.format(self.separator))
class BoMXLSX(BoMLinkable):
""" XLSX options """