1.1 --- a/WebStack/Repositories/Directory.py Sat May 24 15:21:53 2008 +0000 1.2 +++ b/WebStack/Repositories/Directory.py Sun Aug 24 20:51:10 2008 +0200 1.3 @@ -56,6 +56,7 @@ 1.4 # Create a directory and initialise it with a special file. 1.5 1.6 if not os.path.exists(path): 1.7 + os.mkdir(path) 1.8 self.create_resource(self.full_path(self.new_filename)) 1.9 1.10 # Guess the filesystem encoding.
2.1 --- a/examples/BaseHTTPRequestHandler/SimpleWithLoginApp.py Sat May 24 15:21:53 2008 +0000 2.2 +++ b/examples/BaseHTTPRequestHandler/SimpleWithLoginApp.py Sun Aug 24 20:51:10 2008 +0200 2.3 @@ -1,35 +1,25 @@ 2.4 #!/usr/bin/env python 2.5 2.6 from WebStack.Adapters.BaseHTTPRequestHandler import deploy 2.7 -from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 2.8 -from WebStack.Resources.Login import LoginResource, LoginAuthenticator 2.9 -from WebStack.Resources.ResourceMap import MapResource 2.10 -from Simple import SimpleResource 2.11 +from SimpleWithLogin import get_site_map 2.12 + 2.13 +# Change this to be the exact URL. 2.14 +# eg. http://localhost:8000/myapp/login 2.15 + 2.16 +login_url = "http://localhost:8080/login" 2.17 + 2.18 +# Change this to be the URL base for your server. 2.19 +# eg. http://localhost:8000 2.20 + 2.21 +app_url = "http://localhost:8080" # No trailing "/"! 2.22 + 2.23 +# Must match the key used elsewhere. 2.24 + 2.25 +secret_key = "horses" # Must match the login authenticator's key. 2.26 + 2.27 +resource = get_site_map(app_url, login_url, secret_key) 2.28 2.29 print "Serving..." 2.30 -deploy( 2.31 - MapResource({ 2.32 - "simple" : 2.33 - LoginRedirectResource( 2.34 - login_url="http://localhost:8080/login", 2.35 - app_url="http://localhost:8080", 2.36 - resource=SimpleResource(), 2.37 - authenticator=LoginRedirectAuthenticator(secret_key="horses"), 2.38 - anonymous_parameter_name="anonymous", 2.39 - logout_parameter_name="logout" 2.40 - ), 2.41 - "login" : 2.42 - LoginResource( 2.43 - LoginAuthenticator( 2.44 - secret_key="horses", 2.45 - credentials=( 2.46 - ("badger", "abc"), 2.47 - ("vole", "xyz"), 2.48 - ) 2.49 - ) 2.50 - ) 2.51 - }), 2.52 - handle_errors=0 2.53 -) 2.54 +deploy(resource, handle_errors=0) 2.55 2.56 # vim: tabstop=4 expandtab shiftwidth=4
3.1 --- a/examples/BaseHTTPRequestHandler/SimpleWithOpenIDApp.py Sat May 24 15:21:53 2008 +0000 3.2 +++ b/examples/BaseHTTPRequestHandler/SimpleWithOpenIDApp.py Sun Aug 24 20:51:10 2008 +0200 3.3 @@ -4,10 +4,9 @@ 3.4 from SimpleWithOpenID import get_site_map 3.5 3.6 app_url = "http://localhost:8080" # No trailing "/"! 3.7 -initiation_url = "http://localhost:8080/login" 3.8 secret_key = "horses" # Must match the login authenticator's key. 3.9 3.10 -resource = get_site_map(app_url, initiation_url, secret_key) 3.11 +resource = get_site_map(app_url, app_url + "/login", secret_key) 3.12 3.13 print "Serving..." 3.14 deploy(resource, handle_errors=0)
4.1 --- a/examples/CGI/SimpleWithLoginHandler.py Sat May 24 15:21:53 2008 +0000 4.2 +++ b/examples/CGI/SimpleWithLoginHandler.py Sun Aug 24 20:51:10 2008 +0200 4.3 @@ -8,38 +8,24 @@ 4.4 #sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common") 4.5 4.6 from WebStack.Adapters.CGI import deploy 4.7 -from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 4.8 -from WebStack.Resources.Login import LoginResource, LoginAuthenticator 4.9 -from WebStack.Resources.ResourceMap import MapResource 4.10 -from Simple import SimpleResource 4.11 +from SimpleWithLogin import get_site_map 4.12 + 4.13 +# Change this to be the exact URL. 4.14 +# eg. http://localhost:8000/cgi/myapp/requestid 4.15 + 4.16 +login_url = "http://localhost/cgi/simplewithlogin/login" 4.17 + 4.18 +# Change this to be the URL base for your server. 4.19 +# eg. http://localhost:8000 4.20 4.21 -deploy( 4.22 - MapResource({ 4.23 - "simple" : 4.24 - LoginRedirectResource( 4.25 - login_url="http://localhost/cgi/login", # Change this to be the exact URL on your server. 4.26 - # eg. http://localhost:8000/cgi/LoginHandler.py 4.27 - app_url="http://localhost", # Change this to be the URL base for your server. 4.28 - # eg. http://localhost:8000 4.29 - # Note that the login application can be placed on 4.30 - # a different server if desirable. 4.31 - resource=SimpleResource(), 4.32 - authenticator=LoginRedirectAuthenticator(secret_key="horses"), 4.33 - anonymous_parameter_name="anonymous", 4.34 - logout_parameter_name="logout" 4.35 - ), 4.36 - "login" : 4.37 - LoginResource( 4.38 - LoginAuthenticator( 4.39 - secret_key="horses", 4.40 - credentials=( 4.41 - ("badger", "abc"), 4.42 - ("vole", "xyz"), 4.43 - ) 4.44 - ) 4.45 - ) 4.46 - }), 4.47 - handle_errors=0 4.48 -) 4.49 +app_url = "http://localhost" # No trailing "/"! 4.50 + 4.51 +# Must match the key used elsewhere. 4.52 + 4.53 +secret_key = "horses" 4.54 + 4.55 +resource = get_site_map(app_url, login_url, secret_key) 4.56 + 4.57 +deploy(resource, handle_errors=0) 4.58 4.59 # vim: tabstop=4 expandtab shiftwidth=4
5.1 --- a/examples/Common/DemoApp.py Sat May 24 15:21:53 2008 +0000 5.2 +++ b/examples/Common/DemoApp.py Sun Aug 24 20:51:10 2008 +0200 5.3 @@ -7,8 +7,6 @@ 5.4 # Import the things which make the resource work. 5.5 5.6 from WebStack.Resources.ResourceMap import MapResource 5.7 -from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 5.8 -from WebStack.Resources.Login import LoginResource, LoginAuthenticator 5.9 5.10 # Here are all the test resources. 5.11 5.12 @@ -16,6 +14,8 @@ 5.13 from Form import FormResource 5.14 from Sessions import SessionsResource 5.15 from Simple import SimpleResource 5.16 +from SimpleWithLogin import get_site_map as SimpleWithLoginResource 5.17 +from SimpleWithOpenID import get_site_map as SimpleWithOpenIDResource 5.18 from Unicode import UnicodeResource 5.19 from VerySimple import VerySimpleResource 5.20 from Calendar import CalendarResource 5.21 @@ -41,6 +41,7 @@ 5.22 <li><a href="sessions">Session information</a></li> 5.23 <li><a href="simple">Simple test</a></li> 5.24 <li><a href="simplewithlogin">Simple with login test</a></li> 5.25 + <li><a href="simplewithopenid">Simple with OpenID test</a></li> 5.26 <li><a href="unicode">Unicode test</a></li> 5.27 <li><a href="verysimple">Very simple test</a></li> 5.28 <li><a href="webdav://localhost:8080/calendar/">Calendar store example</a> - <strong>requires a WebDAV-capable browser</strong><br /> 5.29 @@ -54,7 +55,7 @@ 5.30 </html>""") 5.31 trans.set_response_code(200) 5.32 5.33 -def get_site(): 5.34 +def get_site(app_url, secret_key): 5.35 5.36 "Define the resource mapping." 5.37 5.38 @@ -63,25 +64,8 @@ 5.39 "form" : FormResource(), 5.40 "sessions" : SessionsResource(), 5.41 "simple" : SimpleResource(), 5.42 - "simplewithlogin" : 5.43 - LoginRedirectResource( 5.44 - login_url="http://localhost:8080/login", 5.45 - app_url="http://localhost:8080", 5.46 - resource=SimpleResource(), 5.47 - authenticator=LoginRedirectAuthenticator(secret_key="horses"), 5.48 - anonymous_parameter_name="anonymous", 5.49 - logout_parameter_name="logout" 5.50 - ), 5.51 - "login" : 5.52 - LoginResource( 5.53 - LoginAuthenticator( 5.54 - secret_key="horses", 5.55 - credentials=( 5.56 - ("badger", "abc"), 5.57 - ("vole", "xyz"), 5.58 - ) 5.59 - ) 5.60 - ), 5.61 + "simplewithlogin" : SimpleWithLoginResource(app_url, app_url + "/simplewithlogin/login", secret_key), 5.62 + "simplewithopenid" : SimpleWithOpenIDResource(app_url, app_url + "/simplewithopenid/login", secret_key), 5.63 "unicode" : UnicodeResource(), 5.64 "verysimple" : VerySimpleResource(), 5.65 "calendar" : CalendarResource(),
6.1 --- a/examples/Common/SimpleWithOpenID/__init__.py Sat May 24 15:21:53 2008 +0000 6.2 +++ b/examples/Common/SimpleWithOpenID/__init__.py Sun Aug 24 20:51:10 2008 +0200 6.3 @@ -10,9 +10,8 @@ 6.4 def get_site_map(app_url, initiation_url, secret_key): 6.5 6.6 """ 6.7 - Resource a resource for the site having the given 'app_url', using the given 6.8 - 'initiation_url' for the OpenID initiation page, and the specified 6.9 - 'secret_key' for authentication tokens. 6.10 + Resource a resource for the site having the given 'app_url' and 6.11 + 'initiation_url', using the given 'secret_key' for authentication tokens. 6.12 """ 6.13 6.14 return MapResource({
7.1 --- a/examples/Django/simplewithloginapp.py Sat May 24 15:21:53 2008 +0000 7.2 +++ b/examples/Django/simplewithloginapp.py Sun Aug 24 20:51:10 2008 +0200 7.3 @@ -1,18 +1,23 @@ 7.4 #!/usr/bin/env python 7.5 7.6 from WebStack.Adapters.Django import deploy 7.7 -from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 7.8 -from Simple import SimpleResource 7.9 +from SimpleWithLogin import get_site_map 7.10 + 7.11 +# Change this to be the exact URL. 7.12 +# eg. http://localhost:8000/django/myapp/login 7.13 + 7.14 +login_url="http://localhost:8080/django/webstack/login" 7.15 7.16 -resource = LoginRedirectResource( 7.17 - login_url="http://localhost:8080/django/webstack/login", 7.18 - app_url="http://localhost:8080", 7.19 - resource=SimpleResource(), 7.20 - authenticator=LoginRedirectAuthenticator(secret_key="horses"), 7.21 - anonymous_parameter_name="anonymous", 7.22 - logout_parameter_name="logout", 7.23 - use_logout_redirect=0 7.24 -) 7.25 +# Change this to be the URL base for your server. 7.26 +# eg. http://localhost:8000 7.27 + 7.28 +app_url = "http://localhost:8080" # No trailing "/"! 7.29 + 7.30 +# Must match the key used elsewhere. 7.31 + 7.32 +secret_key = "horses" # Must match the login authenticator's key. 7.33 + 7.34 +resource = get_site_map(app_url, login_url, secret_key) 7.35 7.36 simplewithlogin = deploy(resource, handle_errors=0) 7.37
8.1 --- a/examples/JavaServlet/SimpleWithLoginApp.py Sat May 24 15:21:53 2008 +0000 8.2 +++ b/examples/JavaServlet/SimpleWithLoginApp.py Sun Aug 24 20:51:10 2008 +0200 8.3 @@ -1,36 +1,26 @@ 8.4 #!/usr/bin/env python 8.5 8.6 from WebStack.Adapters.JavaServlet import deploy 8.7 -from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 8.8 -from WebStack.Resources.Login import LoginResource, LoginAuthenticator 8.9 -from WebStack.Resources.ResourceMap import MapResource 8.10 -from Simple import SimpleResource 8.11 +from SimpleWithLogin import get_site_map 8.12 + 8.13 +# Change this to be the exact URL. 8.14 +# eg. http://localhost:8000/cgi/myapp/requestid 8.15 + 8.16 +login_url = "http://localhost:8080/SimpleWithLoginApp/login" 8.17 + 8.18 +# Change this to be the URL base for your server. 8.19 +# eg. http://localhost:8000 8.20 + 8.21 +app_url = "http://localhost:8080" # No trailing "/"! 8.22 + 8.23 +# Must match the key used elsewhere. 8.24 + 8.25 +secret_key = "horses" 8.26 + 8.27 +resource = get_site_map(app_url, login_url, secret_key) 8.28 8.29 # NOTE: Not sure if the resource should be maintained in a resource pool. 8.30 8.31 -SimpleWithLoginApp = deploy( 8.32 - MapResource({ 8.33 - "simple" : 8.34 - LoginRedirectResource( 8.35 - login_url="http://localhost:8080/SimpleWithLoginApp/login", 8.36 - app_url="http://localhost:8080", 8.37 - resource=SimpleResource(), 8.38 - authenticator=LoginRedirectAuthenticator(secret_key="horses"), 8.39 - anonymous_parameter_name="anonymous", 8.40 - logout_parameter_name="logout" 8.41 - ), 8.42 - "login" : 8.43 - LoginResource( 8.44 - LoginAuthenticator( 8.45 - secret_key="horses", 8.46 - credentials=( 8.47 - ("badger", "abc"), 8.48 - ("vole", "xyz"), 8.49 - ) 8.50 - ) 8.51 - ) 8.52 - }), 8.53 - handle_errors=0 8.54 -) 8.55 +SimpleWithLoginApp = deploy(resource, handle_errors=0) 8.56 8.57 # vim: tabstop=4 expandtab shiftwidth=4
9.1 --- a/examples/ModPython/SimpleWithLoginApp/SimpleWithLoginHandler.py Sat May 24 15:21:53 2008 +0000 9.2 +++ b/examples/ModPython/SimpleWithLoginApp/SimpleWithLoginHandler.py Sun Aug 24 20:51:10 2008 +0200 9.3 @@ -6,21 +6,26 @@ 9.4 sys.path.append(os.path.abspath(os.path.join(__file__, "../../../Common"))) 9.5 9.6 from WebStack.Adapters.ModPython import deploy 9.7 -from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 9.8 -from Simple import SimpleResource 9.9 +from SimpleWithLogin import get_site_map 9.10 + 9.11 +# Change this to be the exact URL. 9.12 +# eg. http://localhost:8000/myapp/login 9.13 + 9.14 +login_url = "http://localhost/login/app" 9.15 + 9.16 +# Change this to be the URL base for your server. 9.17 +# eg. http://localhost:8000 9.18 + 9.19 +app_url = "http://localhost" # No trailing "/"! 9.20 + 9.21 +# Must match the key used elsewhere. 9.22 + 9.23 +secret_key = "horses" 9.24 + 9.25 +resource = get_site_map(app_url, login_url, secret_key) 9.26 9.27 # NOTE: Not sure if the resource should be maintained in a resource pool. 9.28 9.29 -resource = LoginRedirectResource( 9.30 - login_url="http://localhost/login/app", 9.31 - app_url="http://localhost", 9.32 - resource=SimpleResource(), 9.33 - authenticator=LoginRedirectAuthenticator(secret_key="horses"), 9.34 - anonymous_parameter_name="anonymous", 9.35 - logout_parameter_name="logout", 9.36 - use_logout_redirect=0 9.37 -) 9.38 - 9.39 handler, _no_authentication = deploy(resource, handle_errors=0) 9.40 9.41 # vim: tabstop=4 expandtab shiftwidth=4
10.1 --- a/examples/Twisted/SimpleWithLoginApp.py Sat May 24 15:21:53 2008 +0000 10.2 +++ b/examples/Twisted/SimpleWithLoginApp.py Sun Aug 24 20:51:10 2008 +0200 10.3 @@ -1,35 +1,25 @@ 10.4 #!/usr/bin/env python 10.5 10.6 from WebStack.Adapters.Twisted import deploy 10.7 -from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 10.8 -from WebStack.Resources.Login import LoginResource, LoginAuthenticator 10.9 -from WebStack.Resources.ResourceMap import MapResource 10.10 -from Simple import SimpleResource 10.11 +from SimpleWithLogin import get_site_map 10.12 + 10.13 +# Change this to be the exact URL. 10.14 +# eg. http://localhost:8000/myapp/login 10.15 + 10.16 +login_url = "http://localhost:8080/login" 10.17 + 10.18 +# Change this to be the URL base for your server. 10.19 +# eg. http://localhost:8000 10.20 + 10.21 +app_url = "http://localhost:8080" # No trailing "/"! 10.22 + 10.23 +# Must match the key used elsewhere. 10.24 + 10.25 +secret_key = "horses" 10.26 + 10.27 +resource = get_site_map(app_url, login_url, secret_key) 10.28 10.29 print "Serving..." 10.30 -deploy( 10.31 - MapResource({ 10.32 - "simple" : 10.33 - LoginRedirectResource( 10.34 - login_url="http://localhost:8080/login", 10.35 - app_url="http://localhost:8080", 10.36 - resource=SimpleResource(), 10.37 - authenticator=LoginRedirectAuthenticator(secret_key="horses"), 10.38 - anonymous_parameter_name="anonymous", 10.39 - logout_parameter_name="logout" 10.40 - ), 10.41 - "login" : 10.42 - LoginResource( 10.43 - LoginAuthenticator( 10.44 - secret_key="horses", 10.45 - credentials=( 10.46 - ("badger", "abc"), 10.47 - ("vole", "xyz"), 10.48 - ) 10.49 - ) 10.50 - ) 10.51 - }), 10.52 - handle_errors=0 10.53 -) 10.54 +deploy(resource, handle_errors=0) 10.55 10.56 # vim: tabstop=4 expandtab shiftwidth=4
11.1 --- a/examples/WSGI/SimpleWithLoginApp.py Sat May 24 15:21:53 2008 +0000 11.2 +++ b/examples/WSGI/SimpleWithLoginApp.py Sun Aug 24 20:51:10 2008 +0200 11.3 @@ -8,34 +8,24 @@ 11.4 #sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common") 11.5 11.6 from WebStack.Adapters.WSGI import deploy_with_wsgiref as deploy 11.7 -from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 11.8 -from WebStack.Resources.Login import LoginResource, LoginAuthenticator 11.9 -from WebStack.Resources.ResourceMap import MapResource 11.10 -from Simple import SimpleResource 11.11 +from SimpleWithLogin import get_site_map 11.12 + 11.13 +# Change this to be the exact URL. 11.14 +# eg. http://localhost:8000/myapp/login 11.15 + 11.16 +login_url = "http://localhost:8080/login" 11.17 + 11.18 +# Change this to be the URL base for your server. 11.19 +# eg. http://localhost:8000 11.20 11.21 -deploy( 11.22 - MapResource({ 11.23 - "simple" : 11.24 - LoginRedirectResource( 11.25 - login_url="http://localhost:8080/login", 11.26 - app_url="http://localhost:8080", 11.27 - resource=SimpleResource(), 11.28 - authenticator=LoginRedirectAuthenticator(secret_key="horses"), 11.29 - anonymous_parameter_name="anonymous", 11.30 - logout_parameter_name="logout" 11.31 - ), 11.32 - "login" : 11.33 - LoginResource( 11.34 - LoginAuthenticator( 11.35 - secret_key="horses", 11.36 - credentials=( 11.37 - ("badger", "abc"), 11.38 - ("vole", "xyz"), 11.39 - ) 11.40 - ) 11.41 - ) 11.42 - }), 11.43 - handle_errors=0 11.44 -) 11.45 +app_url = "http://localhost:8080" # No trailing "/"! 11.46 + 11.47 +# Must match the key used elsewhere. 11.48 + 11.49 +secret_key = "horses" 11.50 + 11.51 +resource = get_site_map(app_url, login_url, secret_key) 11.52 + 11.53 +deploy(resource, handle_errors=0) 11.54 11.55 # vim: tabstop=4 expandtab shiftwidth=4
12.1 --- a/examples/WSGI/SimpleWithLoginHandler.py Sat May 24 15:21:53 2008 +0000 12.2 +++ b/examples/WSGI/SimpleWithLoginHandler.py Sun Aug 24 20:51:10 2008 +0200 12.3 @@ -8,34 +8,24 @@ 12.4 #sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common") 12.5 12.6 from WebStack.Adapters.WSGI import deploy_as_cgi 12.7 -from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 12.8 -from WebStack.Resources.Login import LoginResource, LoginAuthenticator 12.9 -from WebStack.Resources.ResourceMap import MapResource 12.10 from Simple import SimpleResource 12.11 12.12 -deploy_as_cgi( 12.13 - MapResource({ 12.14 - "simple" : 12.15 - LoginRedirectResource( 12.16 - login_url="http://localhost/wsgi/login", 12.17 - app_url="http://localhost", 12.18 - resource=SimpleResource(), 12.19 - authenticator=LoginRedirectAuthenticator(secret_key="horses"), 12.20 - anonymous_parameter_name="anonymous", 12.21 - logout_parameter_name="logout" 12.22 - ), 12.23 - "login" : 12.24 - LoginResource( 12.25 - LoginAuthenticator( 12.26 - secret_key="horses", 12.27 - credentials=( 12.28 - ("badger", "abc"), 12.29 - ("vole", "xyz"), 12.30 - ) 12.31 - ) 12.32 - ) 12.33 - }), 12.34 - handle_errors=0 12.35 -) 12.36 +# Change this to be the exact URL. 12.37 +# eg. http://localhost:8000/myapp/login 12.38 + 12.39 +login_url = "http://localhost/wsgi/login" 12.40 + 12.41 +# Change this to be the URL base for your server. 12.42 +# eg. http://localhost:8000 12.43 + 12.44 +app_url = "http://localhost" # No trailing "/"! 12.45 + 12.46 +# Must match the key used elsewhere. 12.47 + 12.48 +secret_key = "horses" 12.49 + 12.50 +resource = get_site_map(app_url, login_url, secret_key) 12.51 + 12.52 +deploy_as_cgi(resource, handle_errors=0) 12.53 12.54 # vim: tabstop=4 expandtab shiftwidth=4
13.1 --- a/examples/Webware/SimpleWithLoginApp/__init__.py Sat May 24 15:21:53 2008 +0000 13.2 +++ b/examples/Webware/SimpleWithLoginApp/__init__.py Sun Aug 24 20:51:10 2008 +0200 13.3 @@ -4,38 +4,29 @@ 13.4 Webware plug-in code. 13.5 """ 13.6 13.7 -__version__ = "0.1" 13.8 +__version__ = "1.3" 13.9 13.10 from WebStack.Adapters.Webware import WebStackServletFactory 13.11 -from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 13.12 -from WebStack.Resources.Login import LoginResource, LoginAuthenticator 13.13 -from WebStack.Resources.ResourceMap import MapResource 13.14 -from Simple import SimpleResource 13.15 +from SimpleWithLogin import get_site_map 13.16 + 13.17 +# Change this to be the exact URL. 13.18 +# eg. http://localhost:8000/myapp/login 13.19 + 13.20 +login_url = "http://localhost/webkit/app.login" 13.21 + 13.22 +# Change this to be the URL base for your server. 13.23 +# eg. http://localhost:8000 13.24 + 13.25 +app_url = "http://localhost" # No trailing "/"! 13.26 + 13.27 +# Must match the key used elsewhere. 13.28 + 13.29 +secret_key = "horses" 13.30 + 13.31 +resource = get_site_map(app_url, login_url, secret_key) 13.32 13.33 # NOTE: Initialising a shared resource. 13.34 13.35 -resource = MapResource({ 13.36 - "simple" : 13.37 - LoginRedirectResource( 13.38 - login_url="http://localhost/webkit/app.login", 13.39 - app_url="http://localhost", 13.40 - resource=SimpleResource(), 13.41 - authenticator=LoginRedirectAuthenticator(secret_key="horses"), 13.42 - anonymous_parameter_name="anonymous", 13.43 - logout_parameter_name="logout" 13.44 - ), 13.45 - "login" : 13.46 - LoginResource( 13.47 - LoginAuthenticator( 13.48 - secret_key="horses", 13.49 - credentials=( 13.50 - ("badger", "abc"), 13.51 - ("vole", "xyz"), 13.52 - ) 13.53 - ) 13.54 - ) 13.55 - }) 13.56 - 13.57 def InstallInWebKit(appServer): 13.58 global resource 13.59 app = appServer.application()
14.1 --- a/examples/Webware/SimpleWithLoginContext/__init__.py Sat May 24 15:21:53 2008 +0000 14.2 +++ b/examples/Webware/SimpleWithLoginContext/__init__.py Sun Aug 24 20:51:10 2008 +0200 14.3 @@ -1,39 +1,30 @@ 14.4 #!/usr/bin/env python 14.5 14.6 """ 14.7 -Webware context for the Simple application (post Webware 0.8.1). 14.8 +Webware context for the SimpleWithLogin application (post Webware 0.8.1). 14.9 """ 14.10 14.11 from WebStack.Adapters.Webware import deploy 14.12 -from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 14.13 -from WebStack.Resources.Login import LoginResource, LoginAuthenticator 14.14 -from WebStack.Resources.ResourceMap import MapResource 14.15 -from Simple import SimpleResource 14.16 +from SimpleWithLogin import get_site_map 14.17 + 14.18 +# Change this to be the exact URL. 14.19 +# eg. http://localhost:8000/myapp/login 14.20 + 14.21 +login_url = "http://localhost:9080/simplewithlogin/login" 14.22 + 14.23 +# Change this to be the URL base for your server. 14.24 +# eg. http://localhost:8000 14.25 + 14.26 +app_url = "http://localhost:9080" # No trailing "/"! 14.27 + 14.28 +# Must match the key used elsewhere. 14.29 + 14.30 +secret_key = "horses" 14.31 + 14.32 +resource = get_site_map(app_url, login_url, secret_key) 14.33 14.34 # NOTE: Initialising a shared resource. 14.35 14.36 -resource = MapResource({ 14.37 - "simple" : 14.38 - LoginRedirectResource( 14.39 - login_url="http://localhost:9080/simplewithlogin/login", 14.40 - app_url="http://localhost:9080", 14.41 - resource=SimpleResource(), 14.42 - authenticator=LoginRedirectAuthenticator(secret_key="horses"), 14.43 - anonymous_parameter_name="anonymous", 14.44 - logout_parameter_name="logout" 14.45 - ), 14.46 - "login" : 14.47 - LoginResource( 14.48 - LoginAuthenticator( 14.49 - secret_key="horses", 14.50 - credentials=( 14.51 - ("badger", "abc"), 14.52 - ("vole", "xyz"), 14.53 - ) 14.54 - ) 14.55 - ) 14.56 - }) 14.57 - 14.58 urlParser = deploy(resource, handle_errors=0) 14.59 14.60 # vim: tabstop=4 expandtab shiftwidth=4
15.1 --- a/examples/Zope/SimpleWithLoginProduct/__init__.py Sat May 24 15:21:53 2008 +0000 15.2 +++ b/examples/Zope/SimpleWithLoginProduct/__init__.py Sun Aug 24 20:51:10 2008 +0200 15.3 @@ -9,38 +9,23 @@ 15.4 from WebStack.Adapters.Zope import WebStackAdapterProduct 15.5 from Globals import InitializeClass 15.6 15.7 -# NOTE: Make sure this URL matches your Zope configuration. 15.8 +# Change this to be the URL base for your server. 15.9 +# eg. http://localhost:8000 15.10 15.11 -server_url = "http://localhost:9080" 15.12 +app_url = "http://localhost" # No trailing "/"! 15.13 + 15.14 +# Must match the key used elsewhere. 15.15 + 15.16 +secret_key = "horses" 15.17 15.18 class SimpleWithLoginProduct(WebStackAdapterProduct): 15.19 15.20 meta_type = "Simple with login product" 15.21 15.22 def __init__(self, id, parent_url): 15.23 - WebStackAdapterProduct.__init__(self, id, 15.24 - MapResource({ 15.25 - "simple" : 15.26 - LoginRedirectResource( 15.27 - login_url=parent_url + "/" + id + "/login", 15.28 - app_url=server_url, 15.29 - resource=SimpleResource(), 15.30 - authenticator=LoginRedirectAuthenticator(secret_key="horses"), 15.31 - anonymous_parameter_name="anonymous", 15.32 - logout_parameter_name="logout" 15.33 - ), 15.34 - "login" : 15.35 - LoginResource( 15.36 - LoginAuthenticator( 15.37 - secret_key="horses", 15.38 - credentials=( 15.39 - ("badger", "abc"), 15.40 - ("vole", "xyz"), 15.41 - ) 15.42 - ) 15.43 - ) 15.44 - }) 15.45 - ) 15.46 + login_url = parent_url + "/" + id + "/login" 15.47 + resource = get_site_map(app_url, login_url, secret_key) 15.48 + WebStackAdapterProduct.__init__(self, id, resource) 15.49 15.50 InitializeClass(SimpleWithLoginProduct) 15.51
16.1 --- a/tools/demo.py Sat May 24 15:21:53 2008 +0000 16.2 +++ b/tools/demo.py Sun Aug 24 20:51:10 2008 +0200 16.3 @@ -4,6 +4,11 @@ 16.4 16.5 import os, sys 16.6 16.7 +# Configuration. 16.8 + 16.9 +app_url = "http://localhost:8080" # No trailing "/"! 16.10 +secret_key = "horses" 16.11 + 16.12 # Find out where WebStack's distribution directory is. 16.13 16.14 program = sys.argv[0] 16.15 @@ -19,7 +24,7 @@ 16.16 sys.path.append(os.path.join(base, "examples", "Common")) 16.17 16.18 import DemoApp 16.19 -resource = DemoApp.get_site() 16.20 +resource = DemoApp.get_site(app_url, secret_key) 16.21 16.22 # Try and open the application in a Web browser. 16.23 # The preferred module is Paul's desktop module: 16.24 @@ -33,7 +38,7 @@ 16.25 except ImportError: 16.26 import webbrowser as desktop 16.27 16.28 - desktop.open("http://localhost:8080") 16.29 + desktop.open(app_url) 16.30 16.31 # Special magic incantation to start the demo. 16.32