# Path: papaye/factories/root.py
# APP_ROOT_NAME = '{}_root'.format(APP_NAME)


import importlib
import sys
import transaction
from pkg_resources import EntryPoint
from repoze.evolution.interfaces import IEvolutionManager
from termcolor import colored
from zope.interface import implementer
from papaye.factories.root import APP_ROOT_NAME




def cleanup():
    del(sys.modules['papaye.app_models'])
    del(sys.modules['papaye.models'])
    sys.modules['papaye.models'] = importlib.import_module('papaye.models')


def load_model(model_name):
    def decorated(func):
        func.load_model = importlib.import_module(model_name)
        return func
    return decorated


def out_model(model_name):
    model = importlib.import_module(model_name)

    def wrapper(func):
        def wrapped(root):
            result = func(root, model)
            return result
        return wrapped
    return wrapper


def context_from_root(root):

# Path: papaye/factories/root.py
# APP_ROOT_NAME = '{}_root'.format(APP_NAME)


# Path: papaye/evolve/managers.py
import importlib
import sys
import transaction
from pkg_resources import EntryPoint
from repoze.evolution.interfaces import IEvolutionManager
from termcolor import colored
from zope.interface import implementer
from papaye.factories.root import APP_ROOT_NAME





def cleanup():
    del(sys.modules['papaye.app_models'])
    del(sys.modules['papaye.models'])
    sys.modules['papaye.models'] = importlib.import_module('papaye.models')


def load_model(model_name):
    def decorated(func):
        func.load_model = importlib.import_module(model_name)
        return func
    return decorated


def out_model(model_name):
    model = importlib.import_module(model_name)

    def wrapper(func):
        def wrapped(root):
            result = func(root, model)
            return result
        return wrapped
    return wrapper


def context_from_root(root):

    return root[APP_ROOT_NAME]