VirtualMailManager/Account.py
branchv0.6.x
changeset 266 e14c345b44a1
parent 265 3c0173418d5d
child 275 524f7ed5ad5b
equal deleted inserted replaced
265:3c0173418d5d 266:e14c345b44a1
    92         """Switch the state of the Account's services on or off. See
    92         """Switch the state of the Account's services on or off. See
    93         Account.enable()/Account.disable() for more information."""
    93         Account.enable()/Account.disable() for more information."""
    94         self._chk_state()
    94         self._chk_state()
    95         if service not in (None, 'all', 'imap', 'pop3', 'sieve', 'smtp'):
    95         if service not in (None, 'all', 'imap', 'pop3', 'sieve', 'smtp'):
    96             raise AErr(_(u"Unknown service: '%s'.") % service, UNKNOWN_SERVICE)
    96             raise AErr(_(u"Unknown service: '%s'.") % service, UNKNOWN_SERVICE)
    97         if dcvers >= 0x10200b2:
    97         if dcvers >= 0x10200b02:
    98             sieve_col = 'sieve'
    98             sieve_col = 'sieve'
    99         else:
    99         else:
   100             sieve_col = 'managesieve'
   100             sieve_col = 'managesieve'
   101         if service in ('smtp', 'pop3', 'imap'):
   101         if service in ('smtp', 'pop3', 'imap'):
   102             sql = 'UPDATE users SET %s = %s WHERE uid = %d' % (service, state,
   102             sql = 'UPDATE users SET %s = %s WHERE uid = %d' % (service, state,
   228         if not self._passwd:
   228         if not self._passwd:
   229             raise AErr(_(u"No password set for '%s'.") % self._addr,
   229             raise AErr(_(u"No password set for '%s'.") % self._addr,
   230                        ACCOUNT_MISSING_PASSWORD)
   230                        ACCOUNT_MISSING_PASSWORD)
   231         assert all(isinstance(service, bool) for service in (smtp, pop3, imap,
   231         assert all(isinstance(service, bool) for service in (smtp, pop3, imap,
   232                                                              sieve))
   232                                                              sieve))
   233         if dcvers >= 0x10200b2:
   233         if dcvers >= 0x10200b02:
   234             sieve_col = 'sieve'
   234             sieve_col = 'sieve'
   235         else:
   235         else:
   236             sieve_col = 'managesieve'
   236             sieve_col = 'managesieve'
   237         self._prepare(maillocation)
   237         self._prepare(maillocation)
   238         sql = "INSERT INTO users (local_part, passwd, uid, gid, mid, tid,\
   238         sql = "INSERT INTO users (local_part, passwd, uid, gid, mid, tid,\
   289         `dcvers` : int
   289         `dcvers` : int
   290           The concatenated major and minor version number from
   290           The concatenated major and minor version number from
   291           `dovecot --version`.
   291           `dovecot --version`.
   292         """
   292         """
   293         self._chk_state()
   293         self._chk_state()
   294         if dcvers >= 0x10200b2:
   294         if dcvers >= 0x10200b02:
   295             sieve_col = 'sieve'
   295             sieve_col = 'sieve'
   296         else:
   296         else:
   297             sieve_col = 'managesieve'
   297             sieve_col = 'managesieve'
   298         sql = 'SELECT name, uid, gid, mid, tid, smtp, pop3, imap, %s\
   298         sql = 'SELECT name, uid, gid, mid, tid, smtp, pop3, imap, %s\
   299  FROM users WHERE uid = %d' % (sieve_col, self._uid)
   299  FROM users WHERE uid = %d' % (sieve_col, self._uid)