Exemple #1
0
def mk_caps(cwd, os_path, open_rd, mkRlib, Popen):
    here = ocap.Rd(cwd, os_path, open_rd)
    xf = Xataface.make(here)
    reportMaker = mkReportMaker(mkRlib=mkRlib, xf=xf)
    reportSpec = mkReportSpec(Popen, here)

    return mk_report_app(report_authz=xf.mk_qs_facet(reportMaker),
                         reportSpec=reportSpec)
Exemple #2
0
    def _with_caps():
        from os import environ, path as os_path
        import datetime

        here = ocap.Rd(os_path.dirname(__file__),
                       os_path,
                       open_rd=lambda n: open(n))
        xf = Xataface.make(here)

        if 'SCRIPT_NAME' in environ:
            cgi_main(xf, cal=datetime.date)
        else:
            from sys import argv
            _test_main(argv, xf)
Exemple #3
0
    def _with_caps():
        from traceback import format_exc
        from os import environ, path
        from wsgiref.handlers import CGIHandler

        from sqlalchemy import create_engine

        here = ocap.Rd(path.dirname(__file__), path,
                       lambda n: open(n))
        xf = Xataface.make(here)
        db_engine = mk_db_engine(create_engine, xf)
        upload_app = mk_upload_app(db_access=xf.mk_qs_facet(db_engine))

        if 'SCRIPT_NAME' in environ:
            cgi_main(mkCGIHandler=lambda: CGIHandler(),
                     upload_app=WSGI.error_middleware(format_exc, upload_app))
Exemple #4
0
    def _bootstrap():
        from os import environ

        if 'SCRIPT_NAME' in environ:
            from os import path as os_path
            from wsgiref.handlers import CGIHandler
            from traceback import format_exc

            here = ocap.Rd(os_path.dirname(__file__), os_path,
                           open_rd=lambda n: open(n))
            cgi_main(here,
                     mkCGIHandler=lambda: CGIHandler(),
                     format_exc=format_exc)
        else:
            from sys import argv
            test_main(argv)
Exemple #5
0
def mk_xf(cwd, os_path, open_rd):
    here = ocap.Rd(cwd, os_path, open_rd)
    return Xataface.make(here), here