equal
deleted
inserted
replaced
40 |
40 |
41 Either the 'ssid' keyword argument or one or more of the service |
41 Either the 'ssid' keyword argument or one or more of the service |
42 arguments ('smtp', 'pop3', 'imap', 'sieve') must be provided. |
42 arguments ('smtp', 'pop3', 'imap', 'sieve') must be provided. |
43 |
43 |
44 Arguments: |
44 Arguments: |
45 `dbh` : pyPgSQL.PgSQL.Connection or psycopg2.extensions.connection |
45 `dbh` : psycopg2.extensions.connection |
46 A database connection for the database access. |
46 A database connection for the database access. |
47 |
47 |
48 Keyword arguments: |
48 Keyword arguments: |
49 `ssid` : int |
49 `ssid` : int |
50 The id of the service set (>0) |
50 The id of the service set (>0) |
121 result = dbc.fetchone() |
121 result = dbc.fetchone() |
122 dbc.close() |
122 dbc.close() |
123 if not result: |
123 if not result: |
124 raise ValueError('Unknown service_set id specified: %r' % ssid) |
124 raise ValueError('Unknown service_set id specified: %r' % ssid) |
125 self._ssid = result[0] |
125 self._ssid = result[0] |
126 #self._services.update(zip(SERVICES, result[1:])) |
126 self._services.update(list(zip(SERVICES, result[1:]))) |
127 for key, value in zip(SERVICES, result[1:]): # pyPgSQL compatible |
|
128 self._services[key] = True if value else False |
|
129 |
127 |
130 def _save(self): |
128 def _save(self): |
131 """Store a new service_set in the database.""" |
129 """Store a new service_set in the database.""" |
132 sql = ('INSERT INTO service_set (ssid, smtp, pop3, imap, sieve) ' |
130 sql = ('INSERT INTO service_set (ssid, smtp, pop3, imap, sieve) ' |
133 'VALUES (%(ssid)s, %(smtp)s, %(pop3)s, %(imap)s, %(sieve)s)') |
131 'VALUES (%(ssid)s, %(smtp)s, %(pop3)s, %(imap)s, %(sieve)s)') |