How to use the aldjemy.wrapper.Wrapper function in aldjemy

To help you get started, we’ve selected a few aldjemy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Deepwalker / aldjemy / aldjemy / core.py View on Github external
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
github Deepwalker / aldjemy / aldjemy / sqlite.py View on Github external
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)