Hi, I just went through the Wiki20 Tutorial for Turbogears 2.0
I grabbed the latest version of TG (2.2.0) and I'm running on Python
2.6. I encountered a few errors and one or two minor "huh?!?"
situations. I created a patch for the Wiki20 tutorial text containing
fixes for the errors and two notes for the other issues. I hope it's
all good :)
I couldn't find the files for the source-code excerpts though, so I'll
give you these fixes "manually":
File: wiki_root/snapshots/7/wiki20/controllers/root.py
Line 23 and 25
Error: Uses "tg.url" and "tg.redirect" instead of "url" and
"redirect"!
File: wiki_root/snapshots/8/wiki20/controllers/root.py
Line: 46
Error: The parameter given to the "order_by" call is wrong. It should
be "pagename", with quotes!
And here's the patch for the rest....
--- wiki20.txt.orig 2009-04-26 17:34:03.000000000 +0200
+++ wiki20.txt 2009-04-26 18:15:48.000000000 +0200
@@ -250,15 +250,14 @@
module (so you can use ``import model``).
In order to easily use our model within the application, modify the
-`Wiki-20/wiki20/model/__init__.py` file to add ``Page`` and
``pages_table``
-to the module. Add the following line
-*at the end of the file*:.
+`Wiki-20/wiki20/model/__init__.py` file to add ``Page`` to the
module. Add the
+following line *at the end of the file*:.
.. code-block:: python
- from wiki20.model.page import Page, pages_table
+ from wiki20.model.page import Page
-.. warning:: It's very important that this line is at the end because
``pages_table`` requires the rest of the model to be initialized
before it can be imported:
+.. warning:: In case you want to import unmapped tables directly, it
is very important that this line is at the end because unmapped tables
requires the rest of the model to be initialized before it can be
imported:
Since a wiki is basically a linked collection of pages, we'll define
a
``Page`` class as the name of our model. Create a new file called
`page.py` in the
@@ -365,9 +364,7 @@
.. code:: wiki_root/snapshots/1/wiki20/controllers/root.py
-The first thing we need to do is uncomment the line that imports
``DBSession``.
-
-Next we must import the ``Page`` class from our
+Here we must import the ``Page`` class from our
model. At the end of the ``import`` block, add this line::
from wiki20.model.page import Page
@@ -467,6 +464,10 @@
.. code:: wiki_root/snapshots/1/wiki20/templates/page.html
:section: PageContent
+If your webserver is not runnung anymore, start it up again by
running::
+
+ paster serve --reload development.ini
+
When you refresh the output web page you should see "initial data"
displayed on the page.
.. _editing_pages:
@@ -559,6 +560,11 @@
.. code:: wiki_root/snapshots/5/wiki20/controllers/root.py
+.. note::
+
+ If you try to refresh your page now, you will not see any changes.
Continue
+ reading through the end of this section to see how to update the
template.
+
We need some additional imports, including ``re`` for regular
expressions and
a method called ``publish_parts`` from ``docutils``.
@@ -655,7 +661,7 @@
.. code:: wiki_root/trunk/wiki20/templates/pagelist.html
:language: html
-The section in bold represents the Genshi code of interest. You can
guess that
+Look at the ``ul`` tag following right after the ``h1`` tag. You can
guess that
the ``py:for`` is a python ``for`` loop, modified to fit into
Genshi's XML. It
iterates through each of the ``pages`` (which we'll send in via the
controller,
using a modification you'll see next). For each one, ``Page Name
Here`` is
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---