-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfiles.py
More file actions
executable file
·40 lines (28 loc) · 1.05 KB
/
files.py
File metadata and controls
executable file
·40 lines (28 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import shutil
from api.API.parameters import getCurrentParameters
from ..everything import *
#Flask mail imports
from flask_mail import Message
def removeFiles(username):
""" This function removes the folder that belong to a user.
It should be used when the project is withdrawn
Args:
username (str): The username of the faculty whose folder should be deleted
"""
currentParameter = getCurrentParameters()
folder_path = os.path.join(base_path, cfg["filepaths"]["projectFiles"], str(currentParameter.year), username)
shutil.rmtree(folder_path)
def create_message(subject, recipients, body):
'''
Parameters:
username_email(s) - Emails of the recipients
body - The body of the email
'''
parameters = getCurrentParameters()
adminEmail = parameters.staffsupport_id.username + "@berea.edu"
msg = Message(subject,
sender=app.config['MAIL_DEFAULT_SENDER'],
recipients=[recipients],
cc=[adminEmail]) #create a message instance
msg.html = body
return msg