VirtualMailManager/Account.py
branchv0.6.x
changeset 228 a7b000ca4ac9
parent 227 87db9f1f95ea
child 235 9d3405ed08e5
--- a/VirtualMailManager/Account.py	Tue Mar 02 19:24:36 2010 +0000
+++ b/VirtualMailManager/Account.py	Wed Mar 03 14:32:30 2010 +0000
@@ -8,8 +8,7 @@
 from VirtualMailManager.Domain import Domain
 from VirtualMailManager.EmailAddress import EmailAddress
 from VirtualMailManager.errors import AccountError as AccE
-from VirtualMailManager.maillocation import MailLocation, MAILDIR_NAME, \
-     MBOX_NAME, MDBOX_NAME, SDBOX_NAME
+from VirtualMailManager.maillocation import MailLocation, known_format
 from VirtualMailManager.Transport import Transport
 
 
@@ -76,12 +75,11 @@
         dbc.close()
 
     def _prepare(self, maillocation):
-        if not maillocation.lower() in map(lambda x: x.lower(), (MAILDIR_NAME,
-                                           MBOX_NAME, MDBOX_NAME, SDBOX_NAME)):
-            raise AccE(_(u'Unknown mail_location directory name: %r') %
+        if not known_format(maillocation):                                  
+            raise AccE(_(u'Unknown mail_location mailbox format: %r') %
                        maillocation, ERR.UNKNOWN_MAILLOCATION_NAME)
         self._setID()
-        self._mid = MailLocation(type_=maillocation).mid
+        self._mid = MailLocation(format=maillocation).mid
 
     def _switchState(self, state, dcvers, service):
         if not isinstance(state, bool):