Revision 2826
Added by Aaron Marcuse-Kubitza over 12 years ago
sql_gen.py | ||
---|---|---|
553 | 553 | |
554 | 554 |
null_sentinels = {'text': r'\N'} |
555 | 555 | |
556 |
def ensure_not_null(db, value): |
|
556 |
def ensure_not_null(db, value, ignore_unknown_type=True):
|
|
557 | 557 |
if is_table_col(value): |
558 | 558 |
typed_col = db.col_info(value) |
559 | 559 |
if typed_col.nullable: |
560 | 560 |
try: null = null_sentinels[typed_col.type] |
561 |
except KeyError: pass |
|
562 |
else: return EnsureNotNull(value, null) |
|
561 |
except KeyError: |
|
562 |
if not ignore_unknown_type: raise |
|
563 |
else: value = EnsureNotNull(value, null) |
|
563 | 564 |
return value |
Also available in: Unified diff
sql_gen.py: ensure_not_null(): Added ignore_unknown_type param