summaryrefslogtreecommitdiff
path: root/docs/tutorials/lxmlgraph/step03
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-05-01 10:26:57 +0000
committerChris McDonough <chrism@agendaless.com>2009-05-01 10:26:57 +0000
commitba9b0e647bff1bf0c437ab204ddf11783ed698f8 (patch)
tree1952ebfdc40ae71a3bc54eb10a92a0fe1e8273ec /docs/tutorials/lxmlgraph/step03
parentbc0698e1ac67106346d8c006bddcb38370f7c16b (diff)
downloadpyramid-ba9b0e647bff1bf0c437ab204ddf11783ed698f8.tar.gz
pyramid-ba9b0e647bff1bf0c437ab204ddf11783ed698f8.tar.bz2
pyramid-ba9b0e647bff1bf0c437ab204ddf11783ed698f8.zip
Merge "c-free" branch to trunk.
Diffstat (limited to 'docs/tutorials/lxmlgraph/step03')
-rw-r--r--docs/tutorials/lxmlgraph/step03/myapp/__init__.py1
-rw-r--r--docs/tutorials/lxmlgraph/step03/myapp/configure.zcml16
-rw-r--r--docs/tutorials/lxmlgraph/step03/myapp/models.py42
-rw-r--r--docs/tutorials/lxmlgraph/step03/myapp/samplemodel.xml5
-rw-r--r--docs/tutorials/lxmlgraph/step03/myapp/templates/default.pt8
-rw-r--r--docs/tutorials/lxmlgraph/step03/myapp/templates/xsltview.xsl12
-rw-r--r--docs/tutorials/lxmlgraph/step03/myapp/views.py10
7 files changed, 0 insertions, 94 deletions
diff --git a/docs/tutorials/lxmlgraph/step03/myapp/__init__.py b/docs/tutorials/lxmlgraph/step03/myapp/__init__.py
deleted file mode 100644
index 792d60054..000000000
--- a/docs/tutorials/lxmlgraph/step03/myapp/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-#
diff --git a/docs/tutorials/lxmlgraph/step03/myapp/configure.zcml b/docs/tutorials/lxmlgraph/step03/myapp/configure.zcml
deleted file mode 100644
index 43b766cfb..000000000
--- a/docs/tutorials/lxmlgraph/step03/myapp/configure.zcml
+++ /dev/null
@@ -1,16 +0,0 @@
-<configure xmlns="http://namespaces.repoze.org/bfg">
-
- <include package="repoze.bfg.includes" />
-
- <view
- for=".models.IMyModel"
- view=".views.zpt_view"
- />
-
- <view
- for=".models.IMyModel"
- view=".views.xslt_view"
- name="xsltview.html"
- />
-
-</configure>
diff --git a/docs/tutorials/lxmlgraph/step03/myapp/models.py b/docs/tutorials/lxmlgraph/step03/myapp/models.py
deleted file mode 100644
index 1d93ccdd0..000000000
--- a/docs/tutorials/lxmlgraph/step03/myapp/models.py
+++ /dev/null
@@ -1,42 +0,0 @@
-import os
-
-from zope.interface import implements
-from zope.interface import Attribute
-from zope.interface import Interface
-from lxml import etree
-
-class IMyModel(Interface):
- __name__ = Attribute('Name of the model instance')
-
-class BfgElement(etree.ElementBase):
- """Handle access control and getitem behavior"""
-
- implements(IMyModel)
-
- @property
- def __name__(self):
- return self.xpath("@name")[0]
-
- def __getitem__(self, child_name):
- xp = "*[@name='%s']" % child_name
- matches = self.xpath(xp)
- if len(matches) == 0:
- raise KeyError('No child found for %s' % child_name)
- elif len(matches) > 1:
- raise KeyError('More than one child for %s' % child_name)
- else:
- return matches[0]
-
-def get_root(environ):
- # Setup the custom parser with our BfgElement behavior
- parser_lookup = etree.ElementDefaultClassLookup(element=BfgElement)
- parser = etree.XMLParser()
- parser.set_element_class_lookup(parser_lookup)
-
- # Now load the XML file
- 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/samplemodel.xml b/docs/tutorials/lxmlgraph/step03/myapp/samplemodel.xml
deleted file mode 100644
index bbe474c63..000000000
--- a/docs/tutorials/lxmlgraph/step03/myapp/samplemodel.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<site name="site">
- <document name="a"/>
- <document name="b"/>
-</site>
diff --git a/docs/tutorials/lxmlgraph/step03/myapp/templates/default.pt b/docs/tutorials/lxmlgraph/step03/myapp/templates/default.pt
deleted file mode 100644
index 3cc98ef92..000000000
--- a/docs/tutorials/lxmlgraph/step03/myapp/templates/default.pt
+++ /dev/null
@@ -1,8 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:tal="http://xml.zope.org/namespaces/tal">
- <head></head>
- <body>
- <h1>My template is viewing item: ${name}</h1>
- <p>The node has a tag name of: ${node.tag}.</p>
- </body>
-</html>
diff --git a/docs/tutorials/lxmlgraph/step03/myapp/templates/xsltview.xsl b/docs/tutorials/lxmlgraph/step03/myapp/templates/xsltview.xsl
deleted file mode 100644
index 4d759b15b..000000000
--- a/docs/tutorials/lxmlgraph/step03/myapp/templates/xsltview.xsl
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:template match="/document">
- <html>
- <head/>
- <body>
- <h1>My template is viewing item: <xsl:value-of select="@name"/></h1>
- <p>The node has a name of: <xsl:value-of select="name()"/>.</p>
- </body>
- </html>
- </xsl:template>
-</xsl:stylesheet>
diff --git a/docs/tutorials/lxmlgraph/step03/myapp/views.py b/docs/tutorials/lxmlgraph/step03/myapp/views.py
deleted file mode 100644
index e18c04415..000000000
--- a/docs/tutorials/lxmlgraph/step03/myapp/views.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from repoze.bfg.chameleon_zpt import render_template_to_response
-from repoze.bfg.xslt import render_transform_to_response
-
-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('templates/xsltview.xsl', context)