Serves a WSGI app to browse objects based on a root object or ZODB URI.

def eye(root=None, zodb_uri=None, port=8080):
    """Serves a WSGI app to browse objects based on a root object or ZODB URI.
    """
    if root is not None:
        root_factory = lambda request: Node(root)
    elif zodb_uri is not None:
        if '://' not in zodb_uri:
            # treat it as a file://
            zodb_uri = 'file://' + os.path.abspath(zodb_uri)        
    
        from repoze.zodbconn.finder import PersistentApplicationFinder
        finder = PersistentApplicationFinder(zodb_uri, appmaker=lambda root: Node(root))
        root_factory = lambda request: finder(request.environ)
    else:
        raise RuntimeError("Must specify root object or ZODB URI.")
    
    app = Eye(root_factory)
    
    if 'DEBUG' in os.environ:
        from repoze.debug.pdbpm import PostMortemDebug
        app = PostMortemDebug(app)
    
    serve(app, host='127.0.0.1', port=port)