From 1a7b14de4bc89ef0fd162ef8e62d01926e42b54e Mon Sep 17 00:00:00 2001 From: Paul Everitt Date: Thu, 24 Jul 2008 17:14:16 +0000 Subject: Add tutorial sections --- docs/tutorials/lxmlgraph/step01/myapp/__init__.py | 1 + docs/tutorials/lxmlgraph/step01/myapp/configure.zcml | 13 +++++++++++++ docs/tutorials/lxmlgraph/step01/myapp/models.py | 18 ++++++++++++++++++ docs/tutorials/lxmlgraph/step01/myapp/views.py | 7 +++++++ docs/tutorials/lxmlgraph/step01/run.py | 8 ++++++++ 5 files changed, 47 insertions(+) create mode 100644 docs/tutorials/lxmlgraph/step01/myapp/__init__.py create mode 100644 docs/tutorials/lxmlgraph/step01/myapp/configure.zcml create mode 100644 docs/tutorials/lxmlgraph/step01/myapp/models.py create mode 100644 docs/tutorials/lxmlgraph/step01/myapp/views.py create mode 100644 docs/tutorials/lxmlgraph/step01/run.py (limited to 'docs/tutorials/lxmlgraph/step01') diff --git a/docs/tutorials/lxmlgraph/step01/myapp/__init__.py b/docs/tutorials/lxmlgraph/step01/myapp/__init__.py new file mode 100644 index 000000000..792d60054 --- /dev/null +++ b/docs/tutorials/lxmlgraph/step01/myapp/__init__.py @@ -0,0 +1 @@ +# diff --git a/docs/tutorials/lxmlgraph/step01/myapp/configure.zcml b/docs/tutorials/lxmlgraph/step01/myapp/configure.zcml new file mode 100644 index 000000000..b139396fa --- /dev/null +++ b/docs/tutorials/lxmlgraph/step01/myapp/configure.zcml @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/docs/tutorials/lxmlgraph/step01/myapp/models.py b/docs/tutorials/lxmlgraph/step01/myapp/models.py new file mode 100644 index 000000000..85d603d80 --- /dev/null +++ b/docs/tutorials/lxmlgraph/step01/myapp/models.py @@ -0,0 +1,18 @@ +from zope.interface import implements +from zope.interface import Attribute +from zope.interface import Interface + +class IMyModel(Interface): + __name__ = Attribute('Name of the model instance') + +class MyModel(dict): + implements(IMyModel) + def __init__(self, name): + self.__name__ = name + +root = MyModel('site') +root['a'] = MyModel('a') +root['b'] = MyModel('b') + +def get_root(environ): + return root diff --git a/docs/tutorials/lxmlgraph/step01/myapp/views.py b/docs/tutorials/lxmlgraph/step01/myapp/views.py new file mode 100644 index 000000000..13de3ae31 --- /dev/null +++ b/docs/tutorials/lxmlgraph/step01/myapp/views.py @@ -0,0 +1,7 @@ +from webob import Response + +def my_hello_view(context, request): + response = Response('Hello from %s @ %s' % ( + context.__name__, + request.environ['PATH_INFO'])) + return response diff --git a/docs/tutorials/lxmlgraph/step01/run.py b/docs/tutorials/lxmlgraph/step01/run.py new file mode 100644 index 000000000..1eac209dc --- /dev/null +++ b/docs/tutorials/lxmlgraph/step01/run.py @@ -0,0 +1,8 @@ +from paste import httpserver + +from repoze.bfg import make_app +from myapp.models import get_root +import myapp + +app = make_app(get_root, myapp) +httpserver.serve(app, host='0.0.0.0', port='5432') -- cgit v1.2.3