Exemplo n.º 1
0
    def app(self):
        import mint.repoze
        from mint.repoze.auth import middleware as auth_middleware

        app = make_app(self.get_root, mint.repoze, options=self.options)
        app = auth_middleware(app, self.options["zodb_base"])
        return app
Exemplo n.º 2
0
def app(global_config, **kw):
    """ This function returns a repoze.bfg.router.Router object.
        
        It is usually called by the PasteDeploy framework during ``paster serve``.
        
        >>> from repoze.bfg.router import Router
        >>> app({})
        Traceback (most recent call last):
        ...
        ValueError: No 'zodb_uri' in application configuration.
        
        #>>> isinstance(app({}, zodb_uri='/tmp/tmp.fs'), Router) # currently fails based on multiple configuration init
        #True
        
    """
    # paster app config callback
    import jingle
    from jingle.models import AppMaker
    zodb_uri = kw.get('zodb_uri')
    if zodb_uri is None:
        raise ValueError("No 'zodb_uri' in application configuration.")
    
    zodb_base = kw.get('zodb_base', 'root')
    
    appmaker = AppMaker(zodb_base)
    get_root = PersistentApplicationFinder(zodb_uri, appmaker)
    return make_app(get_root, jingle, options=kw)
Exemplo n.º 3
0
def app(global_config, **kw):
    """ This function returns a repoze.bfg.router.Router object.  It
    is usually called by the PasteDeploy framework during ``paster
    serve``"""
    from myproject.models import get_root
    import myproject
    options = get_options(kw)
    return make_app(get_root, myproject, options=options)
Exemplo n.º 4
0
Arquivo: run.py Projeto: grith/lanyard
def app(global_config, **kw):
    """ This function returns a repoze.bfg.router.Router object.  It
    is usually called by the PasteDeploy framework during ``paster
    serve``"""
    # paster app config callback
    from lanyard.models import get_root
    import lanyard
    return make_app(get_root, lanyard, options=kw)
Exemplo n.º 5
0
def app(global_config, **kw):
    """ This function returns a repoze.bfg.router.Router object.  It
    is usually called by the PasteDeploy framework during ``paster
    serve``"""
    from myproject.models import get_root
    import myproject
    options = get_options(kw)
    return make_app(get_root, myproject, options=options)
Exemplo n.º 6
0
def make_app(global_config, path=None):
    if path is None:
        raise ValueError('repoze.pkgindex requires a directory home')
    from repoze.bfg.router import make_app
    from repoze.pkgindex.models import Directory

    def get_root(environ):
        return Directory(path)

    import repoze.pkgindex
    return make_app(get_root, repoze.pkgindex, options={'path': path})
Exemplo n.º 7
0
def app(global_config, **kw):
    """ This function returns a repoze.bfg.router.Router object.
    
    It is usually called by the PasteDeploy framework during ``paster serve``.
    """
    db_string = kw.get('db_string')
    if db_string is None:
        raise ValueError("No 'db_string' value in application configuration.")

    initialize_sql(db_string, echo=True)
    return make_app(get_root, kelpie, options=kw)
Exemplo n.º 8
0
def make_app(global_config, path=None):
    if path is None:
        raise ValueError("repoze.pkgindex requires a directory home")
    from repoze.bfg.router import make_app
    from repoze.pkgindex.models import Directory

    def get_root(environ):
        return Directory(path)

    import repoze.pkgindex

    return make_app(get_root, repoze.pkgindex, options={"path": path})
Exemplo n.º 9
0
def app(global_config, **kw):
    """ This function returns a repoze.bfg.router.Router object.
    
    It is usually called by the PasteDeploy framework during ``paster serve``.
    """
    # paster app config callback
    import bingo
    from bingo.models import appmaker
    zodb_uri = kw.get('zodb_uri')
    if zodb_uri is None:
        raise ValueError("No 'zodb_uri' in application configuration.")

    get_root = PersistentApplicationFinder(zodb_uri, appmaker)
    return make_app(get_root, bingo, options=kw)
Exemplo n.º 10
0
def main():

    cached_result = get_cache()

    if not cached_result:
        logging.debug('Starting main import')
        import config
        from gae import initialise
        from repoze.bfg.router import make_app
        from testing.models import get_root
        import testing
        logging.debug('about to make app')
        application = make_app(get_root, testing)
        wsgiref.handlers.CGIHandler().run(application)

    else:
        run_wsgi_app(cached_result)
Exemplo n.º 11
0
def main():

    cached_result = get_cache()

    if not cached_result:
        logging.debug("Starting main import")
        import config
        from gae import initialise
        from repoze.bfg.router import make_app
        from testing.models import get_root
        import testing

        logging.debug("about to make app")
        application = make_app(get_root, testing)
        wsgiref.handlers.CGIHandler().run(application)

    else:
        run_wsgi_app(cached_result)
Exemplo n.º 12
0
def app(global_config, roots=None, root_vpath='/', **kw):
    import zopen.cms

    if roots is None:
        raise ValueError('zopen.cms requires a roots')

    for root in roots.split(';'):
        root = root.strip()
        mount_paths.append(root)

    # 根据配置,初始化文件库
    folder = Folder()
    folder.__parent__ = None
    folder.__name__ = ''
    folder.vpath = root_vpath

    def get_root(environ):
        return folder

    return make_app(get_root, zopen.cms, options=kw)
Exemplo n.º 13
0
    def app(self):
#         app = make_app(self.get_root, mint.repoze, authentication_policy=RepozeWho1AuthenticationPolicy(), options=self.options)
        app = make_app(self.get_root, mint.repoze, options=self.options)
        app = auth_middleware(app, self.options['zodb_base'])
        self.app = app
        return self.app
Exemplo n.º 14
0
def main():

    application = make_app(get_root, testing)
    wsgiref.handlers.CGIHandler().run(application)
Exemplo n.º 15
0
def main():
   
    application = make_app(get_root,testing)
    wsgiref.handlers.CGIHandler().run(application)