# Path: papaye/factories/root.py
# def repository_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]['repository']
# 
# Path: papaye/views/api/compat/schemas.py
# class GetPackageSchema(colander.MappingSchema):
#     path = Path()


from cornice import Service
from pyramid.httpexceptions import HTTPNotFound
from pyramid.interfaces import ISettings
from cornice.validators import colander_validator
from papaye.factories.root import repository_root_factory
from .schemas import GetPackageSchema




packages = Service(
    name="packages",
    path="/api/compat/package/json",
    description="List package service",
    context='papaye.models.Root',

# Path: papaye/factories/root.py
# def repository_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]['repository']
# 
# Path: papaye/views/api/compat/schemas.py
# class GetPackageSchema(colander.MappingSchema):
#     path = Path()


# Path: papaye/views/api/compat/api.py
from cornice import Service
from pyramid.httpexceptions import HTTPNotFound
from pyramid.interfaces import ISettings
from cornice.validators import colander_validator
from papaye.factories.root import repository_root_factory
from .schemas import GetPackageSchema





packages = Service(
    name="packages",
    path="/api/compat/package/json",
    description="List package service",
    context='papaye.models.Root',

    factory=repository_root_factory,