forked from ScoDoc/ScoDoc
deal with binary files (zip)
This commit is contained in:
parent
16b3701815
commit
9ee7dec202
@ -164,11 +164,12 @@ def list_directory_filenames(path):
|
||||
return R
|
||||
|
||||
|
||||
def add_local_file_to_zip(zipfile, ziproot, pathname, path_in_zip):
|
||||
def add_local_file_to_zip(zipfile, ziproot, pathname, path_in_zip, mode='r'):
|
||||
"""Read pathname server file and add content to zip under path_in_zip"""
|
||||
rooted_path_in_zip = os.path.join(ziproot, path_in_zip)
|
||||
data = open(pathname).read()
|
||||
breakpoint()
|
||||
with open(rooted_path_in_zip, mode=mode) as f:
|
||||
data = f.read()
|
||||
zipfile.writestr(rooted_path_in_zip, data)
|
||||
|
||||
|
||||
|
@ -471,7 +471,10 @@ class GenTable(object):
|
||||
|
||||
def excel(self, wb=None):
|
||||
"""Simple Excel representation of the table"""
|
||||
if wb is None:
|
||||
ses = sco_excel.ScoExcelSheet(sheet_name=self.xls_sheet_name, wb=wb)
|
||||
else:
|
||||
ses = wb.create_sheet(sheet_name=self.xls_sheet_name)
|
||||
ses.rows += self.xls_before_table
|
||||
style_bold = sco_excel.excel_make_style(bold=True)
|
||||
style_base = sco_excel.excel_make_style()
|
||||
@ -486,8 +489,6 @@ class GenTable(object):
|
||||
ses.append_single_cell_row(self.origin, style_base)
|
||||
if wb is None:
|
||||
return ses.generate()
|
||||
else:
|
||||
ses.generate()
|
||||
|
||||
def text(self):
|
||||
"raw text representation of the table"
|
||||
|
Loading…
Reference in New Issue
Block a user