# Path: papaye/factories/root.py
# def user_root_factory(request_or_connection):
#     if isinstance(request_or_connection, (Request, DummyRequest)):
#         conn = get_connection(request_or_connection)
#     else:
#         conn = request_or_connection
#     zodb_root = conn.root()
#     if not '{}_root'.format(APP_NAME) in zodb_root:
#         return None
#     return zodb_root[APP_ROOT_NAME]['user']
# 
# def application_factory(request):
#     from papaye.models import Application
#     return Application()


from papaye.factories.root import (
    user_root_factory,
    application_factory,
)


def includeme(config):
    config.add_route('login', '/login/', factory=user_root_factory)
    config.add_route('logout', '/logout/')

# Path: papaye/factories/root.py
# def user_root_factory(request_or_connection):
#     if isinstance(request_or_connection, (Request, DummyRequest)):
#         conn = get_connection(request_or_connection)
#     else:
#         conn = request_or_connection
#     zodb_root = conn.root()
#     if not '{}_root'.format(APP_NAME) in zodb_root:
#         return None
#     return zodb_root[APP_ROOT_NAME]['user']
# 
# def application_factory(request):
#     from papaye.models import Application
#     return Application()


# Path: papaye/config/routes.py
from papaye.factories.root import (
    user_root_factory,
    application_factory,
)



def includeme(config):
    config.add_route('login', '/login/', factory=user_root_factory)
    config.add_route('logout', '/logout/')

    config.add_route('home', '/', factory=application_factory)