[Commits] (bkirsch) Updated content model to have error logic

commits at osafoundation.org commits at osafoundation.org
Fri Aug 20 12:34:58 PDT 2004


Commit by: bkirsch
Modified files:
chandler/parcels/osaf/contentmodel/tests/TestMail.py 1.20 1.21
chandler/parcels/osaf/contentmodel/mail/parcel.xml 1.53 1.54
chandler/parcels/osaf/contentmodel/mail/Mail.py 1.17 1.18

Log message:
Updated content model to have error logic

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/contentmodel/tests/TestMail.py.diff?r1=text&tr1=1.20&r2=text&tr2=1.21
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/contentmodel/mail/parcel.xml.diff?r1=text&tr1=1.53&r2=text&tr2=1.54
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/contentmodel/mail/Mail.py.diff?r1=text&tr1=1.17&r2=text&tr2=1.18

Index: chandler/parcels/osaf/contentmodel/tests/TestMail.py
diff -u chandler/parcels/osaf/contentmodel/tests/TestMail.py:1.20 chandler/parcels/osaf/contentmodel/tests/TestMail.py:1.21
--- chandler/parcels/osaf/contentmodel/tests/TestMail.py:1.20	Thu Aug 19 16:57:18 2004
+++ chandler/parcels/osaf/contentmodel/tests/TestMail.py	Fri Aug 20 12:34:56 2004
@@ -2,8 +2,8 @@
 Unit tests for mail
 """
 
-__revision__  = "$Revision: 1.20 $"
-__date__      = "$Date: 2004/08/19 23:57:18 $"
+__revision__  = "$Revision: 1.21 $"
+__date__      = "$Date: 2004/08/20 19:34:56 $"
 __copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -38,6 +38,9 @@
         self.assertEqual(Mail.MailParcel.getSMTPAccountKind(),
                          self.rep.find(Path(mailPath, 'SMTPAccount')))
 
+        self.assertEqual(Mail.MailParcel.getMailDeliveryErrorKind(),
+                         self.rep.find(Path(mailPath, 'MailDeliveryError')))
+
         self.assertEqual(Mail.MailParcel.getMailDeliveryBaseKind(),
                          self.rep.find(Path(mailPath, 'MailDeliveryBase')))
 
@@ -79,6 +82,7 @@
         accountBaseItem = Mail.AccountBase("accountBaseItem")
         imapAccountItem = Mail.IMAPAccount("imapAccountItem")
         smtpAccountItem = Mail.SMTPAccount("smtpAccountItem")
+        mailDeliveryErrorItem = Mail.MailDeliveryError("mailDeliveryErrorItem")
         mailDeliveryBaseItem = Mail.MailDeliveryBase("mailDeliveryBaseItem")
         smtpDeliveryItem = Mail.SMTPDelivery("smtpDeliveryItem")
         imapDeliveryItem = Mail.IMAPDelivery("imapDeliveryItem")
@@ -102,6 +106,9 @@
         self.assertEqual(smtpAccountItem.itsKind,
                          Mail.MailParcel.getSMTPAccountKind())
 
+        self.assertEqual(mailDeliveryErrorItem.itsKind,
+                         Mail.MailParcel.getMailDeliveryErrorKind())
+
         self.assertEqual(mailDeliveryBaseItem.itsKind,
                          Mail.MailParcel.getMailDeliveryBaseKind())
 
@@ -142,9 +149,14 @@
         smtpAccountItem = self.__populateAccount(smtpAccountItem)
         imapAccountItem = self.__populateAccount(imapAccountItem)
 
+        mailDeliveryErrorItem.errorCode = 25
+        mailDeliveryErrorItem.errorString = "Test String"
+        mailDeliveryErrorItem.errorDate = DateTime.now()
+
         mailDeliveryBaseItem.deliveryType = "POP"
         smtpDeliveryItem.deliveryType = "SMTP"
         smtpDeliveryItem.state = "DRAFT"
+        smtpDeliveryItem.deliveryError = mailDeliveryErrorItem
         imapDeliveryItem.deliveryType = "IMAP"
         imapDeliveryItem.uid = 0
         mimeBaseItem.mimeType = "SGML"

Index: chandler/parcels/osaf/contentmodel/mail/parcel.xml
diff -u chandler/parcels/osaf/contentmodel/mail/parcel.xml:1.53 chandler/parcels/osaf/contentmodel/mail/parcel.xml:1.54
--- chandler/parcels/osaf/contentmodel/mail/parcel.xml:1.53	Thu Aug 19 16:57:19 2004
+++ chandler/parcels/osaf/contentmodel/mail/parcel.xml	Fri Aug 20 12:34:56 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.53 $ -->
-<!-- $Date: 2004/08/19 23:57:19 $ -->
+<!-- $Revision: 1.54 $ -->
+<!-- $Date: 2004/08/20 19:34:56 $ -->
 <!-- Copyright (c) 2003-2004 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -178,6 +178,38 @@
 
     </Kind>
 
+    <Kind itsName="MailDeliveryError">
+        <superKinds ref="Item" />
+        <classes key="python" value="osaf.contentmodel.mail.Mail.MailDeliveryError" />
+        <displayName value="Mail Delivery Error kind" />
+        <description value="Contains the error data associated with a MailDelivery Type" />
+
+        <Attribute itsName="errorCode">
+            <displayName value="The Error Code" />
+            <description value="The Error Code returned by the Delivery Transport" />
+            <type ref="Integer" />
+            <initialValue type="Integer" value="0" />
+        </Attribute>
+
+        <Attribute itsName="errorString">
+            <type ref="String" />
+            <initialValue type="String" value="" />
+        </Attribute>
+
+        <Attribute itsName="errorDate">
+            <type ref="DateTime" />
+        </Attribute>
+
+        <Attribute itsName="mailDelivery">
+            <displayName value="Mail Delivery" />
+            <description value="The Mail Delivery that cause this error" />
+            <type ref="mail:MailDeliveryBase" />
+            <initialValue ref="None" />
+            <inverseAttribute ref="mail:MailDeliveryBase/deliveryError" />
+        </Attribute>
+    </Kind>
+
+
     <Kind itsName="MailDeliveryBase">
         <superKinds ref="Item" />
         <classes key="python" value="osaf.contentmodel.mail.Mail.MailDeliveryBase" />
@@ -204,8 +236,17 @@
             <inverseAttribute ref="mail:MailMessageMixin/deliveryExtension" />
         </Attribute>
 
+        <Attribute itsName="deliveryError">
+            <displayName value="Mail Delivery Error" />
+            <description value="The Mail Delivery Error" />
+            <type ref="mail:MailDeliveryError" />
+            <initialValue ref="None" />
+            <inverseAttribute ref="mail:MailDeliveryError/mailDelivery" />
+        </Attribute>
+
     </Kind>
 
+
     <Kind itsName="SMTPDelivery">
         <superKinds ref="mail:MailDeliveryBase" />
         <classes key="python" value="osaf.contentmodel.mail.Mail.SMTPDelivery" />

Index: chandler/parcels/osaf/contentmodel/mail/Mail.py
diff -u chandler/parcels/osaf/contentmodel/mail/Mail.py:1.17 chandler/parcels/osaf/contentmodel/mail/Mail.py:1.18
--- chandler/parcels/osaf/contentmodel/mail/Mail.py:1.17	Tue Aug 17 14:45:39 2004
+++ chandler/parcels/osaf/contentmodel/mail/Mail.py	Fri Aug 20 12:34:57 2004
@@ -1,8 +1,8 @@
 """ Classes used for Mail parcel kinds
 """
 
-__revision__  = "$Revision: 1.17 $"
-__date__      = "$Date: 2004/08/17 21:45:39 $"
+__revision__  = "$Revision: 1.18 $"
+__date__      = "$Date: 2004/08/20 19:34:57 $"
 __copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -32,6 +32,9 @@
         smtpAccountKind = self['SMTPAccount']
         MailParcel.smtpAccountKindID = smtpAccountKind.itsUUID
 
+        mailDeliveryErrorKind = self['MailDeliveryError']
+        MailParcel.mailDeliveryErrorKindID = mailDeliveryErrorKind.itsUUID
+
         mailDeliveryBaseKind = self['MailDeliveryBase']
         MailParcel.mailDeliveryBaseKindID = mailDeliveryBaseKind.itsUUID
 
@@ -86,6 +89,12 @@
 
     getSMTPAccountKind = classmethod(getSMTPAccountKind)
 
+    def getMailDeliveryErrorKind(cls):
+        assert cls.mailDeliveryErrorKindID, "Mail parcel not yet loaded"
+        return Globals.repository[cls.mailDeliveryErrorKindID]
+
+    getMailDeliveryErrorKind = classmethod(getMailDeliveryErrorKind)
+
     def getMailDeliveryBaseKind(cls):
         assert cls.mailDeliveryBaseKindID, "Mail parcel not yet loaded"
         return Globals.repository[cls.mailDeliveryBaseKindID]
@@ -162,6 +171,7 @@
     accountBaseKindID = None
     imapAccountKindID = None
     smtpAccountKindID = None
+    mailDeliveryErrorKindID = None
     mailDeliveryBaseKindID = None
     smtpDeliveryKindID = None
     imapDeliveryKindID = None
@@ -203,6 +213,16 @@
 
         self.accountType = "IMAP"
 
+
+class MailDeliveryError(Item.Item):
+    def __init__(self, name=None, parent=None, kind=None):
+        if not parent:
+            parent = ContentModel.ContentModel.getContentItemParent()
+        if not kind:
+            kind = MailParcel.getMailDeliveryErrorKind()
+        super (MailDeliveryError, self).__init__(name, parent, kind)
+
+
 class MailDeliveryBase(Item.Item):
     def __init__(self, name=None, parent=None, kind=None):
         if not parent:



More information about the Commits mailing list