Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def connection(self):
connection = connections[self.alias]
if connection.connection is None:
connection._cursor()
if connection.vendor == 'sqlite':
return SqliteWrapper(connection.connection)
if self.wrap:
return Wrapper(connection.connection)
return connection.connection
from .wrapper import Wrapper
class SqliteWrapper(Wrapper):
def wrapper(self, obj):
return sqlite_wrapper(obj)
def sqlite_wrapper(func):
from django.db.backends.sqlite3.base import Database
def null_converter(s):
if isinstance(s, bytes):
return s.decode('utf-8')
return s
def wrapper(*a, **kw):
converter = Database.converters.pop('DATETIME')
Database.register_converter("datetime", null_converter)