Project

General

Profile

« Previous | Next » 

Revision 2836

sql_gen.py: ensure_not_null(): Raise NoUnderlyingTableException if can't ensure not null for that reason

View differences:

lib/sql_gen.py
562 562
null_sentinels = {'text': r'\N'}
563 563

  
564 564
def ensure_not_null(db, value, ignore_unknown_type=True):
565
    if is_table_col(value):
566
        typed_col = db.col_info(underlying_col(value))
567
        if typed_col.nullable:
568
            try: null = null_sentinels[typed_col.type]
569
            except KeyError:
570
                if not ignore_unknown_type: raise
571
            else: value = EnsureNotNull(value, null)
565
    typed_col = db.col_info(underlying_col(value))
566
    if typed_col.nullable:
567
        try: null = null_sentinels[typed_col.type]
568
        except KeyError:
569
            if not ignore_unknown_type: raise
570
        else: value = EnsureNotNull(value, null)
572 571
    return value

Also available in: Unified diff