Last active
May 27, 2018 10:11
-
-
Save naveed125/58404554868eb15a00b9fb55308bc1bb to your computer and use it in GitHub Desktop.
Sequential programming example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from User import User | |
from EmailService import EmailService | |
# | |
# main function | |
# | |
def main(): | |
# | |
# Fetch the current user | |
# | |
new_user = User() | |
new_user.load_from_session() | |
# | |
# Welcome email | |
# | |
if new_user.country == "fr": | |
subject = "Bonjour et bienvenue sur notre site" | |
content = "Bonjour et Bienvenue sur notre tout nouveau site. Contactez l'équipe de support si vous avez des..." | |
EmailService.send(new_user.email, subject, content) | |
elif new_user.country == "us" or new_user.country == "ca": | |
subject = "Welcome to our site" | |
content = "Hello and Welcome to our brand new site. Contact support team if you have any questions." | |
EmailService.send(new_user.email, subject, content) | |
# | |
# Age check reminder | |
# | |
if new_user.age < 18: | |
subject = "Important reminder" | |
content = "Important: Please note that user under the age of 18 must provide a signed waiver from a parent ..." | |
EmailService.send(new_user.email, subject, content) | |
# | |
# Payment verification reminder | |
# | |
if new_user.payment_status == "Unverified": | |
subject = "Reminder about your payment status" | |
content = "Please don't forget to update your payment information on our site" | |
EmailService.send(new_user.email, subject, content) | |
# | |
# run main | |
# | |
if __name__ == "__main__": | |
main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment