fix: 账号备份密码如 t08\x08fIE 备份失败

This commit is contained in:
feng
2023-12-28 16:26:49 +08:00
committed by Bryan
parent 6c1c8b241e
commit 219fad9b62
4 changed files with 29 additions and 10 deletions

View File

@@ -4,7 +4,7 @@ from copy import deepcopy
from django.conf import settings
from django.utils import timezone
from openpyxl import Workbook
from xlsxwriter import Workbook
from accounts.const import AutomationTypes, SecretType, SSHKeyStrategy, SecretStrategy
from accounts.models import ChangeSecretRecord
@@ -227,8 +227,9 @@ class ChangeSecretManager(AccountBasePlaybookManager):
rows.insert(0, header)
wb = Workbook(filename)
ws = wb.create_sheet('Sheet1')
ws = wb.add_worksheet('Sheet1')
for row in rows:
ws.append(row)
wb.save(filename)
for col, data in enumerate(row):
ws.write_string(0, col, data)
wb.close()
return True