vergleichbarer Content
authorSandro Knauß <knauss@netzguerilla.net>
Thu, 18 Nov 2010 02:58:28 +0100
changeset 62 35228d665310
parent 61 04dfd43dfecc
child 63 3df3da063cff
vergleichbarer Content
iro/anbieter/content.py
--- a/iro/anbieter/content.py	Thu Nov 18 01:25:28 2010 +0100
+++ b/iro/anbieter/content.py	Thu Nov 18 02:58:28 2010 +0100
@@ -24,6 +24,12 @@
     def getContent(self):
         return self.content
 
+    def __eq__(self,other):
+        return self.content == other.content
+
+    def __ne__(self,other):
+        return not self.__eq__(other)
+
 class SMS(content):
     def __init__(self, cont):
         content.__init__(self,cont)
@@ -31,6 +37,7 @@
     def sendto(self,anbieter,recipients):
         anbieter.sendSMS(self,recipients)
 
+
 class FAX(content):
     def __init__(self,header,cont,attachments):
         content.__init__(self,cont)
@@ -41,9 +48,26 @@
         anbieter.sendFAX(self,recipients)
 
     def getAttachment(self,i):
-        print self.attachments
         return self.attachments[i]
 
+    def __eq__(self,other):
+        if not  content.__eq__(self,other):
+            return False
+
+        if self.header != other.header:
+            return False
+
+        if len(self.attachments) != len(other.attachments):
+            return False
+
+        for i in range(len(self.attachments)):
+            if self.attachments[i] != other.attachments[i]:
+                return False
+
+        return True
+
+
+
 class Mail(content):
     def __init__(self, subject, body, frm):
         con=MIMEText(body.encode("utf-8"), _charset='utf-8')
@@ -60,3 +84,12 @@
 
     def getFrom(self):
         return self.frm
+    
+    def __eq__(self,other):
+        if self.as_string() != other.as_string():
+            return False
+
+        if self.frm != other.frm:
+            return False
+
+        return True