reduced code clutter
This commit is contained in:
parent
797042b97a
commit
a3b20cbb17
@ -5,10 +5,7 @@ import mysql.connector as mysql
|
|||||||
from os import getenv
|
from os import getenv
|
||||||
import time, sys
|
import time, sys
|
||||||
|
|
||||||
code_name = 'INVITES_MANAGER'
|
|
||||||
|
|
||||||
def remove_old(config):
|
def remove_old(config):
|
||||||
global code_name
|
|
||||||
'''
|
'''
|
||||||
Removes invites that are out of date
|
Removes invites that are out of date
|
||||||
'''
|
'''
|
||||||
@ -22,11 +19,10 @@ def remove_old(config):
|
|||||||
|
|
||||||
cursor.close()
|
cursor.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
print(f'[ {code_name} ] : Removed old invites with no errors')
|
print(f'[ {__file__} ] : Removed old invites with no errors')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
fail = False
|
|
||||||
config = {
|
config = {
|
||||||
'database': getenv('DATABASE_NAME'),
|
'database': getenv('DATABASE_NAME'),
|
||||||
'password': getenv('DATABASE_PASS'),
|
'password': getenv('DATABASE_PASS'),
|
||||||
@ -36,11 +32,7 @@ if __name__ == '__main__':
|
|||||||
}
|
}
|
||||||
for k in config:
|
for k in config:
|
||||||
if config[k] is None:
|
if config[k] is None:
|
||||||
print(f'[ {code_name} ] : {k} not set', file=sys.stderr)
|
print(f'[ {__file__} ] : {k} not set', file=sys.stderr)
|
||||||
fail = True
|
|
||||||
|
|
||||||
|
|
||||||
if not fail:
|
|
||||||
remove_old(config)
|
|
||||||
else:
|
else:
|
||||||
exit(1)
|
remove_old(config)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user