Skip to content

Commit f22157a

Browse files
committed
get_events(): Replace clever code with for loop
Evidently I don't have the prior list comprehension code quite right as the results do not include both stripped text fields in addition to other object types. Replaced with a classic for loop and if statement to achieve the desired results. refs #16
1 parent 21da35e commit f22157a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

automated_tickets_lib.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,13 @@ def get_events(settings, event_schedule):
442442
for event in mysql_cursor.fetchall():
443443

444444
# Prune whitespace from all fields
445-
event = tuple([item.strip() if isinstance(item, str) else item for item in event])
445+
# event = tuple([item.strip() else item for item in event])
446+
fields = []
447+
for field in event:
448+
if isinstance(field, str):
449+
field = field.strip()
450+
fields.append(field)
451+
event = tuple(fields)
446452

447453
# Collect a list of all events we need to take action for
448454
events.append(Event(event))

0 commit comments

Comments
 (0)