Contact: fumanchu@aminus.org

Log in as guest/geniusql to create tickets

Changeset 77

Show
Ignore:
Timestamp:
04/18/07 17:33:46
Author:
fumanchu
Message:

New auto_pickle attribute for DatabaseTypeSet?.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/geniusql/dbtypes.py

    r76 r77  
    488488    # You should REALLY check into your DB's encoding and override this. 
    489489    encoding = 'utf8' 
     490    auto_pickle = True 
    490491     
    491492    def __copy__(self): 
     
    524525            and 'signed'. 
    525526        """ 
     527        if hints is None: 
     528            hints = {} 
     529         
    526530        xform = "dbtype_for_" + getCoerceName(pytype) 
    527531        try: 
    528532            xform = getattr(self, xform) 
    529533        except AttributeError: 
    530             raise TypeError("%r is not handled by %s. Tried %r" % 
    531                             (pytype, self.__class__, xform)) 
    532         if hints is None: 
    533             hints = {} 
     534            # Assume we'll use a VARCHAR type and pickle the values. 
     535            if self.auto_pickle: 
     536                return self.dbtype_for_str(hints) 
     537            else: 
     538                raise TypeError("%r is not handled by %s. Tried %r" % 
     539                                (pytype, self.__class__, xform)) 
    534540        return xform(hints) 
    535541     
     
    562568                         % (bytes, dbtype.max_bytes)) 
    563569     
    564     def dbtype_for_dict(self, hints): 
    565         return self.dbtype_for_str(hints) 
    566     def dbtype_for_list(self, hints): 
    567         return self.dbtype_for_str(hints) 
    568     def dbtype_for_tuple(self, hints): 
    569         return self.dbtype_for_str(hints) 
    570570    def dbtype_for_unicode(self, hints): 
    571         return self.dbtype_for_str(hints) 
    572      
    573     def dbtype_for_geniusql_logic_Expression(self, hints): 
    574571        return self.dbtype_for_str(hints) 
    575572