Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
from Database import DatabaseManager # to manage data in .csv files using Pandas
from EmailManager import EmailManager # to send email to subscribed users
from UserInterface import UserInterface # to handle user interaction
import sys # for system calls (Exit) https://docs.python.org/3/library/sys.html
def main():
dm = DatabaseManager() # handles operations on Database
email = EmailManager() # send e-mails
ui = UserInterface() # shows menus and asks for input from user
dm.checkDatabaseExists() # check if the database folder and database files are present or not. Create files if they don't exist
ui.mainMenu() # shows the main menu
select = int(input('>> '))
if select == 1: # opens the admin panel
if ui.adminLogin(): # if admin true
print("Welcome admin")
ui.adminMenu() # shows admin menu
else:
print("Wrong username or password, please retry")
elif select == 2: # User login
re = ui.userLogin() # checks if user exists
if re[0]: # if login is successful
ui.userMenu(re[1]) # shows user menu
else:
print("User not exists or wrong password") # raises the error
elif select == 3:
ui.userSignUp() # registration menu and control panel
elif select == 4: # sends e-mails
re = ui.adminLogin() # login admin
if re: # if login is successful
print("Welcome admin")
email.sendEmails() # starts sending e-mails
else:
print("Wrong Username or Password")
elif select == 5:
print("Thanks for using News Service") # exits the system
sys.exit() # exits the system
if __name__ == '__main__':
while True:
main()