From f7c48fe00eb624432f11142897e18dd78df9f642 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 25 Jul 2008 00:39:59 +0000 Subject: Work on Step 3. --- docs/tutorials/lxmlgraph/step03/myapp/configure.zcml | 2 +- docs/tutorials/lxmlgraph/step03/myapp/default.pt | 8 -------- docs/tutorials/lxmlgraph/step03/myapp/models.py | 9 +++++---- docs/tutorials/lxmlgraph/step03/myapp/templates/default.pt | 8 ++++++++ docs/tutorials/lxmlgraph/step03/myapp/templates/xsltview.xsl | 12 ++++++++++++ docs/tutorials/lxmlgraph/step03/myapp/views.py | 6 +++--- docs/tutorials/lxmlgraph/step03/myapp/xsltview.xsl | 12 ------------ docs/tutorials/lxmlgraph/step03/run.py | 8 -------- 8 files changed, 29 insertions(+), 36 deletions(-) delete mode 100644 docs/tutorials/lxmlgraph/step03/myapp/default.pt create mode 100644 docs/tutorials/lxmlgraph/step03/myapp/templates/default.pt create mode 100644 docs/tutorials/lxmlgraph/step03/myapp/templates/xsltview.xsl delete mode 100644 docs/tutorials/lxmlgraph/step03/myapp/xsltview.xsl delete mode 100644 docs/tutorials/lxmlgraph/step03/run.py (limited to 'docs/tutorials/lxmlgraph/step03') diff --git a/docs/tutorials/lxmlgraph/step03/myapp/configure.zcml b/docs/tutorials/lxmlgraph/step03/myapp/configure.zcml index ef340c283..83d83ab61 100644 --- a/docs/tutorials/lxmlgraph/step03/myapp/configure.zcml +++ b/docs/tutorials/lxmlgraph/step03/myapp/configure.zcml @@ -5,7 +5,7 @@ - - -

My template is viewing item: ${name}

-

The node has a tag name of: ${node.tag}.

- - diff --git a/docs/tutorials/lxmlgraph/step03/myapp/models.py b/docs/tutorials/lxmlgraph/step03/myapp/models.py index 3c03de1a9..1d93ccdd0 100644 --- a/docs/tutorials/lxmlgraph/step03/myapp/models.py +++ b/docs/tutorials/lxmlgraph/step03/myapp/models.py @@ -1,3 +1,5 @@ +import os + from zope.interface import implements from zope.interface import Attribute from zope.interface import Interface @@ -32,10 +34,9 @@ def get_root(environ): parser.set_element_class_lookup(parser_lookup) # Now load the XML file - xmlstring = open("myapp/samplemodel.xml").read() + here = os.path.join(os.path.dirname(__file__)) + samplemodel = os.path.join(here, 'samplemodel.xml') + xmlstring = open(samplemodel).read() root = etree.XML(xmlstring, parser) return root - - - diff --git a/docs/tutorials/lxmlgraph/step03/myapp/templates/default.pt b/docs/tutorials/lxmlgraph/step03/myapp/templates/default.pt new file mode 100644 index 000000000..3cc98ef92 --- /dev/null +++ b/docs/tutorials/lxmlgraph/step03/myapp/templates/default.pt @@ -0,0 +1,8 @@ + + + +

My template is viewing item: ${name}

+

The node has a tag name of: ${node.tag}.

+ + diff --git a/docs/tutorials/lxmlgraph/step03/myapp/templates/xsltview.xsl b/docs/tutorials/lxmlgraph/step03/myapp/templates/xsltview.xsl new file mode 100644 index 000000000..4d759b15b --- /dev/null +++ b/docs/tutorials/lxmlgraph/step03/myapp/templates/xsltview.xsl @@ -0,0 +1,12 @@ + + + + + + +

My template is viewing item:

+

The node has a name of: .

+ + +
+
diff --git a/docs/tutorials/lxmlgraph/step03/myapp/views.py b/docs/tutorials/lxmlgraph/step03/myapp/views.py index c77eca8fe..0ac33ba83 100644 --- a/docs/tutorials/lxmlgraph/step03/myapp/views.py +++ b/docs/tutorials/lxmlgraph/step03/myapp/views.py @@ -1,10 +1,10 @@ from repoze.bfg.template import render_template_to_response from repoze.bfg.template import render_transform_to_response -def zpt_default_view(context, request): - return render_template_to_response("default.pt", +def zpt_view(context, request): + return render_template_to_response("templates/default.pt", name=context.__name__, node=context) def xslt_view(context, request): - return render_transform_to_response("xsltview.xsl", context) + return render_transform_to_response('templates/xsltview.xsl', context) diff --git a/docs/tutorials/lxmlgraph/step03/myapp/xsltview.xsl b/docs/tutorials/lxmlgraph/step03/myapp/xsltview.xsl deleted file mode 100644 index 4d759b15b..000000000 --- a/docs/tutorials/lxmlgraph/step03/myapp/xsltview.xsl +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - -

My template is viewing item:

-

The node has a name of: .

- - -
-
diff --git a/docs/tutorials/lxmlgraph/step03/run.py b/docs/tutorials/lxmlgraph/step03/run.py deleted file mode 100644 index 1eac209dc..000000000 --- a/docs/tutorials/lxmlgraph/step03/run.py +++ /dev/null @@ -1,8 +0,0 @@ -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