diff options
| author | Chris McDonough <chrism@agendaless.com> | 2008-07-24 23:58:03 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2008-07-24 23:58:03 +0000 |
| commit | 74e3c499bec027c08326de7428e99f94aa166c67 (patch) | |
| tree | 83260847007ebd9e6414fc6314134f434777453a /docs/tutorials | |
| parent | af6e13b4a0549b650afd3bb2e8131f0586b6e38f (diff) | |
| download | pyramid-74e3c499bec027c08326de7428e99f94aa166c67.tar.gz pyramid-74e3c499bec027c08326de7428e99f94aa166c67.tar.bz2 pyramid-74e3c499bec027c08326de7428e99f94aa166c67.zip | |
Various tweaks.
Diffstat (limited to 'docs/tutorials')
| -rw-r--r-- | docs/tutorials/lxmlgraph/step02.rst | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/docs/tutorials/lxmlgraph/step02.rst b/docs/tutorials/lxmlgraph/step02.rst index a9edbae15..b53fd0eff 100644 --- a/docs/tutorials/lxmlgraph/step02.rst +++ b/docs/tutorials/lxmlgraph/step02.rst @@ -14,7 +14,7 @@ data. We will leverage the following ``repoze.bfg`` machinery: Our application will need to do these things: - - Use lxml Element classes to inject ``repoze.bfg`` behavior into + - Use ``lxml`` Element classes to inject ``repoze.bfg`` behavior into ``lxml`` nodes - That model class needs to implement the ``repoze.bfg`` publishing @@ -39,24 +39,24 @@ your package: #. In lines 3-4, the ``<site>`` contains 2 top-level children: a and b. These are provided as an element name ``<document>``. This, - also, is meaningfless as far as ``repoze.bfg`` is concerned. + also, is meaningless as far as ``repoze.bfg`` is concerned. However, this is where you compose the information model you are publishing. -The only special constraint is that a node that wants to be "found" by -``repoze.bfg`` in during traversal *must* have an ``name`` attribute. -(The use of ``@name`` corresponds to ``__name__`` in the -``repoze.bfg`` sense of ``repoze.bfg`` :term:`location`). Each hop in -the URL tries to grab a child with an attribute matching the next hop. -Also, the value of the ``@name`` should be unique in its containing -node. +The only special constraint is that an XML node that wants to be +"found" by ``repoze.bfg`` in during traversal *must* have a ``name`` +attribute. (The use of ``@name`` corresponds to ``__name__`` in the +``repoze.bfg`` sense of ``repoze.bfg`` :term:`location` ). Each hop +in the URL tries to grab a child with an attribute matching the next +hop. Also, the value of the ``@name`` should be unique in its +containing node. Module ``models.py`` ------------------------------ -At a high level, we make write a class that "extends" lxml Element -nodes, create an lxml parser, and register the custom class with the +At a high level, we make write a class that "extends" ``lxml`` Element +nodes, create an ``lxml`` parser, and register the custom class with the parser. Replace the contents of the autogenerated ``models.py`` with the content we show below. @@ -66,7 +66,7 @@ the content we show below. #. Line 4 imports lxml. #. Line 9 creates the custom class we are going to use to extend - etree.ElementBase. The lxml website has great documentation on the + etree.ElementBase. The ``lxml`` website has great documentation on the various ways to inject custom Python behavior into XML. #. Just as before, line 12 says that instances of this class support a @@ -84,7 +84,7 @@ the content we show below. return it. If not, or if more than one is found, raise an error. #. As before, ``get_root`` is the function that is expected to return - the top of the model. In lines 30+ we do the lxml magic to get the + the top of the model. In lines 30+ we do the ``lxml`` magic to get the custom Python class registered. We then load some XML and return the top of the tree. |
