# HG changeset patch # User Pascal Volk # Date 1270260853 0 # Node ID 9d3405ed08e56688d8bc9f58d54b026b9b44af24 # Parent e88ba0fb12810a354b8bbd550e0679216acbffd3 VMM/Transport: Renamed attribute/property {,_}id to {,_}tid. diff -r e88ba0fb1281 -r 9d3405ed08e5 VirtualMailManager/Account.py --- a/VirtualMailManager/Account.py Fri Apr 02 17:30:44 2010 +0000 +++ b/VirtualMailManager/Account.py Sat Apr 03 02:14:13 2010 +0000 @@ -170,7 +170,7 @@ dbc.execute('UPDATE users SET passwd = %s WHERE uid = %s', value, self._uid) elif what == 'transport': - self._tid = Transport(self._dbh, transport=value).id + self._tid = Transport(self._dbh, transport=value).tid dbc.execute('UPDATE users SET tid = %s WHERE uid = %s', self._tid, self._uid) else: diff -r e88ba0fb1281 -r 9d3405ed08e5 VirtualMailManager/Transport.py --- a/VirtualMailManager/Transport.py Fri Apr 02 17:30:44 2010 +0000 +++ b/VirtualMailManager/Transport.py Sat Apr 03 02:14:13 2010 +0000 @@ -16,7 +16,7 @@ class Transport(object): """A wrapper class that provides access to the transport table""" - __slots__ = ('_id', '_transport', '_dbh') + __slots__ = ('_tid', '_transport', '_dbh') def __init__(self, dbh, tid=None, transport=None): """Creates a new Transport instance. @@ -34,7 +34,7 @@ assert any((tid, transport)) if tid: assert not isinstance(tid, bool) and isinstance(tid, (int, long)) - self._id = tid + self._tid = tid self._loadByID() else: assert isinstance(transport, basestring) @@ -42,9 +42,9 @@ self._loadByName() @property - def id(self): + def tid(self): """The transport's unique ID.""" - return self._id + return self._tid @property def transport(self): @@ -53,12 +53,12 @@ def __eq__(self, other): if isinstance(other, self.__class__): - return self._id == other.id + return self._tid == other.tid return NotImplemented def __ne__(self, other): if isinstance(other, self.__class__): - return self._id != other.id + return self._tid != other.tid return NotImplemented def __str__(self): @@ -66,7 +66,7 @@ def _loadByID(self): dbc = self._dbh.cursor() - dbc.execute('SELECT transport FROM transport WHERE tid = %s', self._id) + dbc.execute('SELECT transport FROM transport WHERE tid=%s', self._tid) result = dbc.fetchone() dbc.close() if result: @@ -82,15 +82,15 @@ result = dbc.fetchone() dbc.close() if result: - self._id = result[0] + self._tid = result[0] else: self._save() def _save(self): dbc = self._dbh.cursor() dbc.execute("SELECT nextval('transport_id')") - self._id = dbc.fetchone()[0] - dbc.execute('INSERT INTO transport VALUES (%s, %s)', self._id, + self._tid = dbc.fetchone()[0] + dbc.execute('INSERT INTO transport VALUES (%s, %s)', self._tid, self._transport) self._dbh.commit() dbc.close()