Revision 2661
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql_gen.py | ||
---|---|---|
197 | 197 |
|
198 | 198 |
def keys(self): return self.dict.keys() |
199 | 199 |
|
200 |
def __getitem__(self, key): |
|
201 |
return self.dict[self._key(key)] |
|
200 |
def __getitem__(self, key): return self.dict[self._key(key)] |
|
202 | 201 |
|
203 | 202 |
def __setitem__(self, key, value): |
204 | 203 |
key = self._key(key) |
204 |
if value == None: value = self.db.col_default(key) |
|
205 | 205 |
self.dict[key] = as_Col(value, name=key.name) |
206 | 206 |
|
207 | 207 |
def _key(self, key): return as_Col(key, self.table) |
Also available in: Unified diff
sql_gen.py: ColDict.__setitem__(): Translate NULL values to the appropriate default value of the key column (which is often NULL, but not always) so that select query filtering/joins work correctly