Fix #1 - NoneType' object is not subscriptable
This commit is contained in:
pare
e4a2f56ae2
commit
be741e599a
S'han modificat 1 arxius amb 11 adicions i 3 eliminacions
12
mailing.py
12
mailing.py
|
@ -49,6 +49,7 @@ def write_db(now, id, username, email, emailed_at, emailed):
|
|||
delta = now-row[0]
|
||||
|
||||
cur.execute("UPDATE " + mailing_db_table + " SET elapsed_days=(%s), email=(%s), emailed=(%s) where account_id=(%s)", (delta, email, emailed, id))
|
||||
print("Updating user " + str(id))
|
||||
|
||||
conn.commit()
|
||||
|
||||
|
@ -117,8 +118,11 @@ def check_alive(id):
|
|||
cur.execute("select last_sign_in_at from users where account_id=(%s)", (id,))
|
||||
|
||||
row = cur.fetchone()
|
||||
seen = row[0]
|
||||
|
||||
if row != None:
|
||||
seen = row[0]
|
||||
else:
|
||||
seen = None
|
||||
cur.close()
|
||||
|
||||
return seen
|
||||
|
@ -221,9 +225,13 @@ while i < len(inactive_users_id):
|
|||
email_datetime = row[0]
|
||||
email_datetime = email_datetime.replace(tzinfo=None)
|
||||
|
||||
if email_datetime < seen:
|
||||
if seen != None:
|
||||
reactivated = email_datetime < seen
|
||||
|
||||
if reactivated == True or seen == None: #if inactive user reactivated its account or deleted it we must delete related row from 'mailing_db_table'
|
||||
|
||||
cur.execute("DELETE FROM " + mailing_db_table + " where account_id=(%s)", (inactive_users_id[i],))
|
||||
print("Deleting user " + str(inactive_users_id[i]))
|
||||
|
||||
conn.commit()
|
||||
|
||||
|
|
Loading…
Referencia en una nova incidència