# Path: boiler/feature/orm.py
# def orm_feature(app):


import logging
from flask import current_app
from boiler.feature.orm import db
    def log(self, message, level=None):
        """ Write a message to log """
        if level is None:
            level = logging.INFO

        current_app.logger.log(msg=message, level=level)

    def is_instance(self, model):
        """
        Is instance?
        Checks if provided object is instance of this service's model.

        :param model:           object
        :return:                bool
        """
        result = isinstance(model, self.__model__)
        if result is True:
            return True

        err = 'Object {} is not of type {}'
        raise ValueError(err.format(model, self.__model__))

    def commit(self):
        """
        Commit
        Commits orm transaction. Used mostly for bulk operations when
        flush is of to commit multiple items at once.

        :return:                None
        """

# Path: boiler/feature/orm.py
# def orm_feature(app):


# Path: boiler/abstract/abstract_service.py
import logging
from flask import current_app
from boiler.feature.orm import db

    def log(self, message, level=None):
        """ Write a message to log """
        if level is None:
            level = logging.INFO

        current_app.logger.log(msg=message, level=level)

    def is_instance(self, model):
        """
        Is instance?
        Checks if provided object is instance of this service's model.

        :param model:           object
        :return:                bool
        """
        result = isinstance(model, self.__model__)
        if result is True:
            return True

        err = 'Object {} is not of type {}'
        raise ValueError(err.format(model, self.__model__))

    def commit(self):
        """
        Commit
        Commits orm transaction. Used mostly for bulk operations when
        flush is of to commit multiple items at once.

        :return:                None
        """

        db.session.commit()