Source code for

# -*- coding: utf-8 -*-
"""CherryPy root object class."""
from json import dumps
import cherrypy
from pacifica.metadata.orm.all_objects import ORM_OBJECTS
from import ObjectInfoAPI
from import UserInfoAPI
from import ProjectInfoAPI
from import TransactionInfoAPI
from import FileInfoAPI
from import IngestAPI
from import InstrumentInfoAPI
from import SummaryInfoAPI
from import MigrationInfoAPI
from import TkvInfoAPI
from import TkvUploadAPI
from import DOIUploadAPI

[docs]def error_page_default(**kwargs): """The default error page should always enforce json.""" cherrypy.response.headers['Content-Type'] = 'application/json' return dumps({ 'status': kwargs['status'], 'message': kwargs['message'], 'traceback': kwargs['traceback'], 'version': kwargs['version'] })
# pylint: disable=too-few-public-methods
[docs]class Root(object): """ CherryPy root object class. not exposed by default the base objects are exposed """ exposed = True objectinfo = ObjectInfoAPI() userinfo = UserInfoAPI() projectinfo = ProjectInfoAPI() fileinfo = FileInfoAPI() transactioninfo = TransactionInfoAPI() instrumentinfo = InstrumentInfoAPI() summaryinfo = SummaryInfoAPI() ingest = IngestAPI() migrate = MigrationInfoAPI() tkvinfo = TkvInfoAPI() tkvupload = TkvUploadAPI() doiupload = DOIUploadAPI()
# pylint: enable=too-few-public-methods for cls in ORM_OBJECTS: # this is based on the module name being something like pacifica.metadata.orm.BLAH obj_loc = cls.__module__.split('.')[3] setattr(Root, obj_loc, cls())