def report_conflicts(self):
"""Write a date conflicts report in a file."""
with open("conflict_stats.txt", 'w') as statsfile:
+ statsfile.write("Total date conflicts to be corrected (total1) and total messages without received headers (total2):\n\n")
owner_total_conflicts = {}
owner_total_missing = {}
for user in self.data:
+ statsfile.write("total1 \t\t total2 \t mailbox \n")
owner_total_conflicts[user] = 0
owner_total_missing[user] = 0
for box_key in self.data[user]:
owner_total_conflicts[user] += self.data[user][box_key].date_conflicts
owner_total_missing[user] += self.data[user][box_key].no_received_field
- statsfile.write("Total date conflicts to be corrected in a mailbox {0} are {1}.\n"\
- .format(self.data[user][box_key].name, self.data[user][box_key].date_conflicts))
- statsfile.write("Total messages without received headers in a mailbox {0} are {1}.\n"\
- .format(self.data[user][box_key].name, self.data[user][box_key].no_received_field))
- statsfile.write("Total date conflicts to be corrected for user {0} are {1}.\n\n"\
- .format(user, owner_total_missing[user]))
+ statsfile.write("{0} \t\t {1} \t\t {2}\n"\
+ .format(self.data[user][box_key].date_conflicts,
+ self.data[user][box_key].no_received_field,
+ self.data[user][box_key].name))
+ statsfile.write("\n{0} \t\t {1} \t\t {2}\n\n"\
+ .format(owner_total_conflicts[user], owner_total_missing[user], user))
return