1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/Django/authapp.py Sat Jan 14 01:53:54 2006 +0000
1.3 @@ -0,0 +1,12 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +from WebStack.Adapters import Django
1.7 +from Auth import AuthResource, AuthAuthenticator
1.8 +
1.9 +resource = AuthResource()
1.10 +authenticator = AuthAuthenticator()
1.11 +
1.12 +def auth(request, *args):
1.13 + return Django.respond(request, resource, authenticator=authenticator, handle_errors=0)
1.14 +
1.15 +# vim: tabstop=4 expandtab shiftwidth=4
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/examples/Django/calendarapp.py Sat Jan 14 01:53:54 2006 +0000
2.3 @@ -0,0 +1,14 @@
2.4 +#!/usr/bin/env python
2.5 +
2.6 +from WebStack.Adapters import Django
2.7 +from Calendar import CalendarResource
2.8 +
2.9 +# Choose or customise one of the following if the example fails.
2.10 +
2.11 +resource = CalendarResource()
2.12 +#resource = CalendarResource("iso-8859-1")
2.13 +
2.14 +def calendar(request, *args):
2.15 + return Django.respond(request, resource, handle_errors=0)
2.16 +
2.17 +# vim: tabstop=4 expandtab shiftwidth=4
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/examples/Django/cookiesapp.py Sat Jan 14 01:53:54 2006 +0000
3.3 @@ -0,0 +1,11 @@
3.4 +#!/usr/bin/env python
3.5 +
3.6 +from WebStack.Adapters import Django
3.7 +from Cookies import CookiesResource
3.8 +
3.9 +resource = CookiesResource()
3.10 +
3.11 +def cookies(request, *args):
3.12 + return Django.respond(request, resource, handle_errors=0)
3.13 +
3.14 +# vim: tabstop=4 expandtab shiftwidth=4
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/examples/Django/formapp.py Sat Jan 14 01:53:54 2006 +0000
4.3 @@ -0,0 +1,11 @@
4.4 +#!/usr/bin/env python
4.5 +
4.6 +from WebStack.Adapters import Django
4.7 +from Form import FormResource
4.8 +
4.9 +resource = FormResource()
4.10 +
4.11 +def form(request, *args):
4.12 + return Django.respond(request, resource, handle_errors=0)
4.13 +
4.14 +# vim: tabstop=4 expandtab shiftwidth=4
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/examples/Django/loginapp.py Sat Jan 14 01:53:54 2006 +0000
5.3 @@ -0,0 +1,20 @@
5.4 +#!/usr/bin/env python
5.5 +
5.6 +from WebStack.Adapters import Django
5.7 +from WebStack.Resources.Login import LoginResource, LoginAuthenticator
5.8 +
5.9 +resource = LoginResource(
5.10 + LoginAuthenticator(
5.11 + secret_key="horses",
5.12 + credentials=(
5.13 + ("badger", "abc"),
5.14 + ("vole", "xyz"),
5.15 + )
5.16 + ),
5.17 + use_redirect=0
5.18 +)
5.19 +
5.20 +def login(request, *args):
5.21 + return Django.respond(request, resource, handle_errors=0)
5.22 +
5.23 +# vim: tabstop=4 expandtab shiftwidth=4
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/examples/Django/sessionsapp.py Sat Jan 14 01:53:54 2006 +0000
6.3 @@ -0,0 +1,11 @@
6.4 +#!/usr/bin/env python
6.5 +
6.6 +from WebStack.Adapters import Django
6.7 +from Sessions import SessionsResource
6.8 +
6.9 +resource = SessionsResource()
6.10 +
6.11 +def sessions(request, *args):
6.12 + return Django.respond(request, resource, handle_errors=0)
6.13 +
6.14 +# vim: tabstop=4 expandtab shiftwidth=4
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/examples/Django/simpleapp.py Sat Jan 14 01:53:54 2006 +0000
7.3 @@ -0,0 +1,11 @@
7.4 +#!/usr/bin/env python
7.5 +
7.6 +from WebStack.Adapters import Django
7.7 +from Simple import SimpleResource
7.8 +
7.9 +resource = SimpleResource()
7.10 +
7.11 +def simple(request, *args):
7.12 + return Django.respond(request, resource, handle_errors=0)
7.13 +
7.14 +# vim: tabstop=4 expandtab shiftwidth=4
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/examples/Django/simplewithloginapp.py Sat Jan 14 01:53:54 2006 +0000
8.3 @@ -0,0 +1,20 @@
8.4 +#!/usr/bin/env python
8.5 +
8.6 +from WebStack.Adapters import Django
8.7 +from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator
8.8 +from Simple import SimpleResource
8.9 +
8.10 +resource = LoginRedirectResource(
8.11 + login_url="http://localhost/login/app.login",
8.12 + app_url="http://localhost",
8.13 + resource=SimpleResource(),
8.14 + authenticator=LoginRedirectAuthenticator(secret_key="horses"),
8.15 + anonymous_parameter_name="anonymous",
8.16 + logout_parameter_name="logout",
8.17 + use_logout_redirect=0
8.18 +)
8.19 +
8.20 +def loginredirect(request, *args):
8.21 + return Django.respond(request, resource, handle_errors=0)
8.22 +
8.23 +# vim: tabstop=4 expandtab shiftwidth=4
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/examples/Django/verysimpleapp.py Sat Jan 14 01:53:54 2006 +0000
9.3 @@ -0,0 +1,11 @@
9.4 +#!/usr/bin/env python
9.5 +
9.6 +from WebStack.Adapters import Django
9.7 +from VerySimple import VerySimpleResource
9.8 +
9.9 +resource = VerySimpleResource()
9.10 +
9.11 +def verysimple(request, *args):
9.12 + return Django.respond(request, resource, handle_errors=0)
9.13 +
9.14 +# vim: tabstop=4 expandtab shiftwidth=4