From ba9b0e647bff1bf0c437ab204ddf11783ed698f8 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 1 May 2009 10:26:57 +0000 Subject: Merge "c-free" branch to trunk. --- docs/tutorials/lxmlgraph/step04/myapp/__init__.py | 1 - .../lxmlgraph/step04/myapp/configure.zcml | 10 ---- docs/tutorials/lxmlgraph/step04/myapp/models.py | 45 -------------- .../lxmlgraph/step04/myapp/samplemodel.xml | 44 -------------- docs/tutorials/lxmlgraph/step04/myapp/views.py | 13 ---- docs/tutorials/lxmlgraph/step04/myapp/xsltview.xsl | 69 ---------------------- docs/tutorials/lxmlgraph/step04/run.py | 8 --- 7 files changed, 190 deletions(-) delete mode 100644 docs/tutorials/lxmlgraph/step04/myapp/__init__.py delete mode 100644 docs/tutorials/lxmlgraph/step04/myapp/configure.zcml delete mode 100644 docs/tutorials/lxmlgraph/step04/myapp/models.py delete mode 100644 docs/tutorials/lxmlgraph/step04/myapp/samplemodel.xml delete mode 100644 docs/tutorials/lxmlgraph/step04/myapp/views.py delete mode 100644 docs/tutorials/lxmlgraph/step04/myapp/xsltview.xsl delete mode 100644 docs/tutorials/lxmlgraph/step04/run.py (limited to 'docs/tutorials/lxmlgraph/step04') diff --git a/docs/tutorials/lxmlgraph/step04/myapp/__init__.py b/docs/tutorials/lxmlgraph/step04/myapp/__init__.py deleted file mode 100644 index 792d60054..000000000 --- a/docs/tutorials/lxmlgraph/step04/myapp/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# diff --git a/docs/tutorials/lxmlgraph/step04/myapp/configure.zcml b/docs/tutorials/lxmlgraph/step04/myapp/configure.zcml deleted file mode 100644 index c2d59effb..000000000 --- a/docs/tutorials/lxmlgraph/step04/myapp/configure.zcml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/docs/tutorials/lxmlgraph/step04/myapp/models.py b/docs/tutorials/lxmlgraph/step04/myapp/models.py deleted file mode 100644 index a0d64ef59..000000000 --- a/docs/tutorials/lxmlgraph/step04/myapp/models.py +++ /dev/null @@ -1,45 +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/step04/myapp/samplemodel.xml b/docs/tutorials/lxmlgraph/step04/myapp/samplemodel.xml deleted file mode 100644 index 36ab335d2..000000000 --- a/docs/tutorials/lxmlgraph/step04/myapp/samplemodel.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - My XMLGRAPH Website - - Site Home Page - -
-

Welcome to the site. We have lots to say.

-

Or, maybe not.

-
- -
- - Folder One - - doc1 in folder1 - -
-

I am in an HTML div so I can do LOTS of - formatting.

-
- -
- - doc2 in folder1 - -
-

Keep this on one line.

-
- -
-
- - The Second Folder - - doc1 in folder2 - -
-

This is a special folder. It's folder 2!

-
- -
-
-
diff --git a/docs/tutorials/lxmlgraph/step04/myapp/views.py b/docs/tutorials/lxmlgraph/step04/myapp/views.py deleted file mode 100644 index f079cea8c..000000000 --- a/docs/tutorials/lxmlgraph/step04/myapp/views.py +++ /dev/null @@ -1,13 +0,0 @@ -from repoze.bfg.xslt import render_transform_to_response - -# Some constants -XML_NAMESPACE='http://www.w3.org/XML/1998/namespace' -XML_PREFIX= '{%s}' % XML_NAMESPACE - -def xslt_view(context, request): - # Grab the root of the tree, which should be a - site = context.getroottree().getroot() - # Jot down which node we're sitting on as the - contextid = "'%s'" % context.get(XML_PREFIX+'id') - return render_transform_to_response("xsltview.xsl", site, - contextid=contextid) diff --git a/docs/tutorials/lxmlgraph/step04/myapp/xsltview.xsl b/docs/tutorials/lxmlgraph/step04/myapp/xsltview.xsl deleted file mode 100644 index 2406987d0..000000000 --- a/docs/tutorials/lxmlgraph/step04/myapp/xsltview.xsl +++ /dev/null @@ -1,69 +0,0 @@ - - - n1 - - - - - - <xsl:value-of select="$contextnode/title"/> - - - -

- -

- - - - - - - - - - - - - - - - -
Type@xml:id@nameParent TypeParent @name
- - - - - - - - - -
- - -
- -

- Folders are special, they contain things. -

- -

Folder Contents

- -
-
- -

- Documents contain text. -

- -
-
diff --git a/docs/tutorials/lxmlgraph/step04/run.py b/docs/tutorials/lxmlgraph/step04/run.py deleted file mode 100644 index 1eac209dc..000000000 --- a/docs/tutorials/lxmlgraph/step04/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