VMM/account: Made Account._services available as account.SERVICES. v0.6.x
authorPascal Volk <neverseen@users.sourceforge.net>
Thu, 05 Aug 2010 00:12:52 +0000
branchv0.6.x
changeset 338 45834dcc280e
parent 337 150ddcc8b315
child 339 abff2de9eed0
VMM/account: Made Account._services available as account.SERVICES.
VirtualMailManager/account.py
--- a/VirtualMailManager/account.py	Wed Aug 04 18:41:46 2010 +0000
+++ b/VirtualMailManager/account.py	Thu Aug 05 00:12:52 2010 +0000
@@ -20,6 +20,9 @@
 from VirtualMailManager.maillocation import MailLocation
 from VirtualMailManager.password import pwhash
 
+__all__ = ('SERVICES', 'Account', 'get_account_by_uid')
+
+SERVICES = ('imap', 'pop3', 'smtp', 'sieve')
 
 _ = lambda msg: msg
 cfg_dget = lambda option: None
@@ -29,7 +32,6 @@
     """Class to manage e-mail accounts."""
     __slots__ = ('_addr', '_dbh', '_domain', '_mail', '_new', '_passwd',
                  '_transport', '_uid')
-    _services = ('imap', 'pop3', 'smtp', 'sieve')
 
     def __init__(self, dbh, address):
         """Creates a new Account instance.
@@ -119,11 +121,11 @@
         if services:
             services = set(services)
             for service in services:
-                if service not in self.__class__._services:
+                if service not in SERVICES:
                     raise AErr(_(u"Unknown service: '%s'.") % service,
                                UNKNOWN_SERVICE)
         else:
-            services = self.__class__._services
+            services = SERVICES
         state = ('FALSE', 'TRUE')[activate]
         sql = 'UPDATE users SET %s WHERE uid = %u' % (
                     (' = %(s)s, '.join(services) + ' = %(s)s') % {'s': state},