VirtualMailManager/serviceset.py
branchv0.6.x
changeset 440 1a08fe35b496
parent 439 39036f5e6387
child 443 e2b9e3de2b51
equal deleted inserted replaced
439:39036f5e6387 440:1a08fe35b496
    55         `sieve` : bool
    55         `sieve` : bool
    56           Boolean flag for service sieve - default `True`
    56           Boolean flag for service sieve - default `True`
    57         """
    57         """
    58         self._dbh = dbh
    58         self._dbh = dbh
    59         self._ssid = 0
    59         self._ssid = 0
    60         self._services = dict.fromkeys(self.__class__._kwargs[1:], True)
    60         self._services = dict.fromkeys(SERVICES, True)
    61         if cfg_dget('misc.dovecot_version') < 0x10200b02:
    61         if cfg_dget('misc.dovecot_version') < 0x10200b02:
    62             self._sieve_col = 'managesieve'
    62             self._sieve_col = 'managesieve'
    63         else:
    63         else:
    64             self._sieve_col = 'sieve'
    64             self._sieve_col = 'sieve'
    65 
    65 
   125         result = dbc.fetchone()
   125         result = dbc.fetchone()
   126         dbc.close()
   126         dbc.close()
   127         if not result:
   127         if not result:
   128             raise ValueError('Unknown service_set id specified: %r' % ssid)
   128             raise ValueError('Unknown service_set id specified: %r' % ssid)
   129         self._ssid = result[0]
   129         self._ssid = result[0]
   130         self._services.update(zip(self.__class__._kwargs[1:], result[1:]))
   130         self._services.update(zip(SERVICES, result[1:]))
   131 
   131 
   132     def _save(self):
   132     def _save(self):
   133         """Store a new service_set in the database."""
   133         """Store a new service_set in the database."""
   134         sql = ('INSERT INTO service_set (ssid, smtp, pop3, imap, %s) ' %
   134         sql = ('INSERT INTO service_set (ssid, smtp, pop3, imap, %s) ' %
   135                (self._sieve_col,) +
   135                (self._sieve_col,) +