forked from Shihadt/status_report
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.py
62 lines (53 loc) · 1.46 KB
/
index.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from make_file import write_to_file
from make_file import read_file
from quickstart import email_function
from make_file import format_date
import sys
def read_data(filename):
data = ""
inp = open(filename,'r')
for line in inp:
data = data + line
return data
def display_data(file1, file2):
inp = open(file1,'r')
print "work done: "
for line in inp:
print line
inp.close()
print "to do:"
inp = open(file2,'r')
for line in inp:
print line
inp.close()
def read_conf():
infile = open(sys.argv[1]+'/conf.in','r')
fro = infile.readline()
to = infile.readline()
cc = infile.readline()
pname = infile.readline()
fro = fro[5:].strip()
to = to[3:].strip()
cc = cc[3:].strip()
pname=pname[6:]
print("From: " + fro)
print("To: " + to)
print("CC: " + cc + "\n\n")
t=(fro,to,cc,pname)
return t
def main(fro,to,cc,project):
path = sys.argv[1]
path = path+"/"
work_done = read_file(path + "work_done.txt")
todo = read_file(path + "todo.txt")
write_to_file(path + "body.html",project,work_done,todo,path)
data = read_data(path + "body.html")
subject = "Status Report - " + format_date()
answer = 'no'
display_data(path + 'work_done.txt', path + 'todo.txt')
print "do u want to send data(y)?"
answer = raw_input()
if answer == 'y':
email_function(fro,to,cc,subject,data)
t = read_conf()
main(t[0], t[1], t[2],t[3])