def __init__(self, zk_servers): self.manager_running = False ReactorApi.__init__(self, zk_servers) self.config.add_route("api-servers", "/api_servers") self.config.add_view(self.set_api_servers, route_name="api-servers") # Set up auth-ticket authentication self.config.set_authentication_policy(AuthTktAuthenticationPolicy("gridcentricreactor")) self.config.set_authorization_policy(ACLAuthorizationPolicy()) # Add a login page self.config.add_route("admin-login", "/admin/login") self.config.add_view(self.admin_login, route_name="admin-login") # Add a logout page self.config.add_route("admin-logout", "/admin/logout") self.config.add_view(self.admin_logout, route_name="admin-logout") # Note: views are routed on a first-matched basis, so the ordering # of the following add_route calls are important since fetches to # /admin/assets could be matched by either the admin-asset or # admin-object routes (and we want them to go to admin-asset, # so that they can be fetched even in unathenticated contexts). self.config.add_route("admin-home", "/admin/") self.config.add_route("admin-passwd", "/admin/passwd") self.config.add_route("admin-asset", "/admin/assets/{object_name:.*}") self.config.add_route("admin-page", "/admin/{page_name}") self.config.add_route("admin-object", "/admin/{page_name}/{object_name:.*}") self.config.add_view(self.admin, route_name="admin-home") self.config.add_view(self.admin_passwd, route_name="admin-passwd") self.config.add_view(self.admin_asset, route_name="admin-asset") self.config.add_view(self.admin, route_name="admin-page") self.config.add_view(self.admin, route_name="admin-object") self.config.add_view(context="pyramid.exceptions.NotFound", view="pyramid.view.append_slash_notfound_view") # Check the endpoint. self.check(zk_servers)