All pastes #93677 Raw Edit

Verso Oficial

public python v1 · immutable
#93677 ·published 2006-07-20 17:35 UTC
rendered paste body
def _quote(x):	if type(x) == types.StringType:		x = "'" + string.replace(str(x), "'", "''") + "'"	elif type(x) in (types.IntType, types.LongType, types.FloatType):		pass	elif x is None:		x = 'NULL'	elif isinstance(x, datetime.date):		x = "{d'%04d-%02d-%02d'}" % (x.year, x.month, x.day)	elif hasattr(x, '__pg_repr__'):		x = x.__pg_repr__()	else:		#print "didn't like " + x + " " + str(type(x))		raise InterfaceError, 'do not know how to handle type %s' % type(x)