Project

General

Profile

« Previous | Next » 

Revision 2462

sql_gen.py: Added remove_col_rename() and use it where `if isinstance(value, NamedCol): value = value.code` was used

View differences:

lib/sql_gen.py
125 125
    
126 126
    def to_Col(self): return Col(self.name)
127 127

  
128
def remove_col_rename(col):
129
    if isinstance(col, NamedCol): col = col.code
130
    return col
131

  
128 132
##### Conditions
129 133

  
130 134
class ColValueCond(Code):
......
141 145
class ValueCond(objects.BasicObject):
142 146
    def __init__(self, value):
143 147
        if not isinstance(value, Code): value = Literal(value)
144
        if isinstance(value, NamedCol): value = value.code
148
        value = remove_col_rename(value)
145 149
        
146 150
        self.value = value
147 151
    
......
164 168
    
165 169
    def to_str(self, db, left_value):
166 170
        if not isinstance(left_value, Code): left_value = Col(left_value)
167
        if isinstance(left_value, NamedCol): left_value = left_value.code
171
        left_value = remove_col_rename(left_value)
168 172
        
169 173
        right_value = self.value
170 174
        left = left_value.to_str(db)

Also available in: Unified diff