[gsoc-admin] email.py: Add EmailTemplate class



commit 406b56205942afa5760aac4357412c981ad0c4e0
Author: Lasse Schuirmann <lasse schuirmann gmail com>
Date:   Wed Aug 12 12:12:16 2015 +0200

    email.py: Add EmailTemplate class

 email/email.py |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/email/email.py b/email/email.py
index e5fe9aa..2528470 100755
--- a/email/email.py
+++ b/email/email.py
@@ -1,6 +1,17 @@
 #!/usr/bin/env python3
 
+
+class EmailTemplate:
+    def __init__(self, text, recipients):
+        self.text = text
+        self.recipients = recipients
+
+    def get_specific(self, data_dict):
+        return self.text.format(**data_dict)
+
+
 template_file = open('../data/templates/foo')
 template_text = template_file.read()
+template = EmailTemplate(template_text, None)
 format_dict = {'student_name': 'Rupert Monkey'}
-print(template_text.format(**format_dict))
+print(template.get_specific(format_dict))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]