Navigation

Quick search

Source code for sqlobject.converters

fromarrayimportarrayimportdatetimefromdecimalimportDecimalimporttimeimportsysfrom.compatimportPY2,buffer_typeifPY2:fromtypesimportClassType,InstanceType,NoneTypeelse:# Use suitable aliases for nowClassType=typeNoneType=type(None)# This is may not be what we want in all cases, but will do for nowInstanceType=objecttry:frommx.DateTimeimportDateTimeType,DateTimeDeltaTypeexceptImportError:try:fromDateTimeimportDateTimeType,DateTimeDeltaTypeexceptImportError:DateTimeType=NoneDateTimeDeltaType=Nonetry:importSybaseNumericType=Sybase.NumericTypeexceptImportError:NumericType=None######################################### Quoting########################################sqlStringReplace=[("'","''"),('\\','\\\\'),('\000','\\0'),('\b','\\b'),('\n','\\n'),('\r','\\r'),('\t','\\t'),]

[docs]deflookupConverter(self,value,default=None):# python 3 doesn't have classic classes, so everything's# in self.klass due to comparison order in registerConvertorreturnself.klass.get(value.__class__,default)