[kupfer: 5/51] obj.contacts: Add EmailContact



commit abdb5ca7a2fff3b12c68f9eddb167a11fd7aa584
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Tue Jan 5 21:58:25 2010 +0100

    obj.contacts: Add EmailContact
    
    EmailContact is a "shortcut" to create a ContactLeaf with an email
    address as the only data.

 kupfer/obj/contacts.py |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/obj/contacts.py b/kupfer/obj/contacts.py
new file mode 100644
index 0000000..c25207e
--- /dev/null
+++ b/kupfer/obj/contacts.py
@@ -0,0 +1,13 @@
+from kupfer.obj.grouping import ContactLeaf, EMAIL_KEY, NAME_KEY
+
+class EmailContact (ContactLeaf):
+	def __init__(self, email, name):
+		slots = {EMAIL_KEY: email, NAME_KEY: name}
+		ContactLeaf.__init__(self, slots, name)
+
+	def repr_key(self):
+		return self.object[EMAIL_KEY]
+
+	def get_description(self):
+		return self.object[EMAIL_KEY]
+



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