fix: document merger
This commit is contained in:
@@ -266,6 +266,8 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
|
|||||||
class Skip(Action):
|
class Skip(Action):
|
||||||
@classmethod
|
@classmethod
|
||||||
def prepare(cls):
|
def prepare(cls):
|
||||||
|
nonlocal status
|
||||||
|
status = Status.RUNNING
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -311,6 +313,7 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
|
|||||||
data = b64decode(b64)
|
data = b64decode(b64)
|
||||||
buffer = BytesIO(data)
|
buffer = BytesIO(data)
|
||||||
source = load_workbook(buffer)
|
source = load_workbook(buffer)
|
||||||
|
source.active.cell(1, col).value = column.sent
|
||||||
|
|
||||||
for row in range(options.get('start'), limit + 1):
|
for row in range(options.get('start'), limit + 1):
|
||||||
c1 = source.active.cell(row, col)
|
c1 = source.active.cell(row, col)
|
||||||
@@ -355,7 +358,7 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
|
|||||||
raise Cancel()
|
raise Cancel()
|
||||||
|
|
||||||
if column.sent not in headers:
|
if column.sent not in headers:
|
||||||
wb.active.cell(1, wb.active.max_column + 1).value = column.sent
|
logger.warning("Column '%s' is not found; creating now...", column.sent)
|
||||||
headers.append(column.sent)
|
headers.append(column.sent)
|
||||||
|
|
||||||
logger.info('Read %s line(s) total', limit)
|
logger.info('Read %s line(s) total', limit)
|
||||||
@@ -367,7 +370,6 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
|
|||||||
|
|
||||||
progress['done'] = 0
|
progress['done'] = 0
|
||||||
progress['skip'] = 0
|
progress['skip'] = 0
|
||||||
progress['next'] = 0
|
|
||||||
progress['subject'] = subject
|
progress['subject'] = subject
|
||||||
logger.info('Done')
|
logger.info('Done')
|
||||||
except Cancel:
|
except Cancel:
|
||||||
@@ -515,9 +517,9 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
|
|||||||
except Cancel:
|
except Cancel:
|
||||||
break
|
break
|
||||||
except (Next, Skip) as e:
|
except (Next, Skip) as e:
|
||||||
progress[e.__class__.__name__.lower()] += 1
|
|
||||||
index += 1
|
index += 1
|
||||||
attempts = 0
|
attempts = 0
|
||||||
|
if isinstance(e, Skip): progress['skip'] += 1
|
||||||
continue
|
continue
|
||||||
except (MismatchedEmailAddress, MismatchedEmailSubject) as e:
|
except (MismatchedEmailAddress, MismatchedEmailSubject) as e:
|
||||||
logger.error('Input mismatched', exc_info=e)
|
logger.error('Input mismatched', exc_info=e)
|
||||||
|
|||||||
Reference in New Issue
Block a user