1 #!/usr/bin/env python 2 3 """ 4 Webware plug-in code. 5 """ 6 7 __version__ = "0.1" 8 9 from WebStack.Adapters.Webware import WebStackServletFactory 10 from Simple import SimpleResource 11 from LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 12 13 # NOTE: Initialising a shared resource. 14 15 resource = LoginRedirectResource( 16 login_url="http://localhost/webkit/app.login", 17 app_url="http://localhost", 18 resource=SimpleResource(), 19 authenticator=LoginRedirectAuthenticator(secret_key="horses"), 20 anonymous_parameter_name="anonymous", 21 logout_parameter_name="logout" 22 ) 23 24 def InstallInWebKit(appServer): 25 global resource 26 app = appServer.application() 27 28 # NOTE: Allow .xsimple files only. Really, we'd like any kind of file, but 29 # NOTE: that would severely undermine the servlet factory concept. 30 31 app.addServletFactory(WebStackServletFactory(app, resource, [".xsimple"])) 32 33 # vim: tabstop=4 expandtab shiftwidth=4