Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@for_type("date", adapt=False)
def _date(self, value):
return serializers.json(value)
@for_type("geometry", adapt=False)
def _geometry(self, value, srid):
return "geometry::STGeomFromText('%s',%s)" % (value, srid)
@for_type("reference")
def _reference(self, value):
if isinstance(value, (Row, Reference)):
value = value["id"]
return long(value)
@for_type('datetime')
def _datetime(self, value):
return value
@for_type("decimal", adapt=False)
def _decimal(self, value):
return str(value)
@for_type("password")
def _password(self, value):
return to_unicode(value)
@for_type("bigint")
def _bigint(self, value):
return long(value)
@for_type("list:integer")
def _list_integer(self, value):
if not isinstance(value, list):
return int(value)
values = self._represent_list(value)
return list(map(int, values))
@for_type('list:reference')
def _list_reference(self, value):
values = self._represent_list(value)
return list(map(self.adapter.object_id, values))
@for_type("json")
def _json(self, value):
if isinstance(value, basestring):
value = to_unicode(value)
value = json.loads(value)
return value