Changeset 3238

Show
Ignore:
Timestamp:
07/11/07 20:00:59 (1 year ago)
Author:
paul
Message:

This is a test to see if this resolves ticket #1072. If it does, we need to:

+ go through the other db adapters and similarly modify any str()

coersions.

+ apply these fixes to stable, too.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/db/dbSQLite.py

    r3237 r3238  
    6464        sl = "\\" 
    6565        qt = "\'" 
    66         return qt + str(val).replace(sl, sl+sl).replace(qt, qt+qt) + qt 
     66        if not isinstance(val, basestring): 
     67            # Make sure we aren't trying to coerce unicode chars to str 
     68            val = str(val) 
     69        return qt + val.replace(sl, sl+sl).replace(qt, qt+qt) + qt 
    6770     
    6871     
     
    9295        """ We need to wrap the value in quotes. """ 
    9396        sqt = "'"       # single quote 
    94         return "%s%s%s" % (sqt, str(val), sqt) 
     97        if not isinstance(val, basestring): 
     98            val = str(val) 
     99        return "%s%s%s" % (sqt, val, sqt) 
    95100         
    96101