forked from ScoDoc/ScoDoc
geb_tables: meilleur msg erreur si template pdf invalide
This commit is contained in:
parent
a5c0619102
commit
ec108a4454
@ -58,6 +58,7 @@ from app.scodoc import sco_utils as scu
|
|||||||
from app.scodoc import sco_excel
|
from app.scodoc import sco_excel
|
||||||
from app.scodoc import sco_pdf
|
from app.scodoc import sco_pdf
|
||||||
from app.scodoc import sco_xml
|
from app.scodoc import sco_xml
|
||||||
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
from app.scodoc.sco_pdf import SU
|
from app.scodoc.sco_pdf import SU
|
||||||
from app import log
|
from app import log
|
||||||
|
|
||||||
@ -539,17 +540,18 @@ class GenTable(object):
|
|||||||
#
|
#
|
||||||
# titles = ["<para><b>%s</b></para>" % x for x in self.get_titles_list()]
|
# titles = ["<para><b>%s</b></para>" % x for x in self.get_titles_list()]
|
||||||
pdf_style_list = []
|
pdf_style_list = []
|
||||||
Pt = [
|
data_list = self.get_data_list(
|
||||||
[Paragraph(SU(str(x)), CellStyle) for x in line]
|
|
||||||
for line in (
|
|
||||||
self.get_data_list(
|
|
||||||
pdf_mode=True,
|
pdf_mode=True,
|
||||||
pdf_style_list=pdf_style_list,
|
pdf_style_list=pdf_style_list,
|
||||||
with_titles=True,
|
with_titles=True,
|
||||||
omit_hidden_lines=True,
|
omit_hidden_lines=True,
|
||||||
)
|
)
|
||||||
)
|
try:
|
||||||
|
Pt = [
|
||||||
|
[Paragraph(SU(str(x)), CellStyle) for x in line] for line in data_list
|
||||||
]
|
]
|
||||||
|
except ValueError as exc:
|
||||||
|
raise ScoValueError(f"Erreur dans un format pdf: <br/>{str(exc)}") from exc
|
||||||
pdf_style_list += self.pdf_table_style
|
pdf_style_list += self.pdf_table_style
|
||||||
T = Table(Pt, repeatRows=1, colWidths=self.pdf_col_widths, style=pdf_style_list)
|
T = Table(Pt, repeatRows=1, colWidths=self.pdf_col_widths, style=pdf_style_list)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user