83 dbc.close() |
83 dbc.close() |
84 if result: |
84 if result: |
85 self._uid, _mid, _qid, _ssid, _tid, _note = result |
85 self._uid, _mid, _qid, _ssid, _tid, _note = result |
86 |
86 |
87 def load_helper(ctor, own, field, dbresult): |
87 def load_helper(ctor, own, field, dbresult): |
88 cur = None if own is None else getattr(own, field) |
88 # Py25: cur = None if own is None else getattr(own, field) |
|
89 if own is None: |
|
90 cur = None |
|
91 else: |
|
92 cur = getattr(own, field) |
89 if cur != dbresult: |
93 if cur != dbresult: |
90 kwargs = { field : dbresult } |
94 kwargs = {field: dbresult} |
91 return None if dbresult is None \ |
95 if dbresult is None: |
92 else ctor(self._dbh, **kwargs) |
96 return dbresult |
|
97 else: |
|
98 return ctor(self._dbh, **kwargs) |
93 |
99 |
94 self._qlimit = load_helper(QuotaLimit, self._qlimit, 'qid', _qid) |
100 self._qlimit = load_helper(QuotaLimit, self._qlimit, 'qid', _qid) |
95 self._services = load_helper(ServiceSet, self._services, 'ssid', |
101 self._services = load_helper(ServiceSet, self._services, 'ssid', |
96 _ssid) |
102 _ssid) |
97 self._transport = load_helper(Transport, self._transport, 'tid', |
103 self._transport = load_helper(Transport, self._transport, 'tid', |