VirtualMailManager/mailbox.py
branchv0.6.x
changeset 322 94bd10e237e5
parent 320 011066435e6f
child 323 d58cc465dc61
equal deleted inserted replaced
321:883d5cd66498 322:94bd10e237e5
   273     """
   273     """
   274 
   274 
   275     __slots__ = ()
   275     __slots__ = ()
   276 
   276 
   277 
   277 
   278 def __get_mailbox_class(mbfmt):
       
   279     if mbfmt == 'maildir':
       
   280         return Maildir
       
   281     elif mbfmt == 'mdbox':
       
   282         return MultiDbox
       
   283     elif mbfmt == 'sdbox':
       
   284         return SingleDbox
       
   285     raise ValueError('unsupported mailbox format: %r' % mbfmt)
       
   286 
       
   287 
       
   288 def new(account):
   278 def new(account):
   289     """Create a new Mailbox instance for the given Account."""
   279     """Create a new Mailbox instance for the given Account."""
   290     return __get_mailbox_class(account.mail_location.mbformat)(account)
   280     mbfmt = account.mail_location.mbformat
       
   281     if mbfmt == 'maildir':
       
   282         return Maildir(account)
       
   283     elif mbfmt == 'mdbox':
       
   284         return MultiDbox(account)
       
   285     elif mbfmt == 'sdbox':
       
   286         return SingleDbox(account)
       
   287     raise ValueError('unsupported mailbox format: %r' % mbfmt)
   291 
   288 
   292 del cfg_dget
   289 del cfg_dget