# HG changeset patch
# User cmlenz
# Date 1188849543 0
# Node ID 9822dfff0fd5d9c01298b246230774e5c35d5385
# Parent 3ed77fbfafa83116ed63d9c29e4a7826da1a4980
GenshiTutorial: tweaks to sync with code on wiki page.
diff --git a/examples/tutorial/geddit/controller.py b/examples/tutorial/geddit/controller.py
--- a/examples/tutorial/geddit/controller.py
+++ b/examples/tutorial/geddit/controller.py
@@ -1,9 +1,6 @@
#!/usr/bin/env python
-import operator
-import os
-import pickle
-import sys
+import operator, os, pickle, sys
import cherrypy
from formencode import Invalid
@@ -20,18 +17,6 @@
self.data = data
@cherrypy.expose
- @template.output('index.xml', method='xml')
- def feed(self, id=None):
- if id:
- link = self.data.get(id)
- if not link:
- raise cherrypy.NotFound()
- return template.render('info.xml', link=link)
- else:
- links = sorted(self.data.values(), key=operator.attrgetter('time'))
- return template.render(links=links)
-
- @cherrypy.expose
@template.output('index.html')
def index(self):
links = sorted(self.data.values(), key=operator.attrgetter('time'))
@@ -92,6 +77,18 @@
stream = template.render(link=link, comment=None, errors=errors)
return stream | HTMLFormFiller(data=data)
+ @cherrypy.expose
+ @template.output('index.xml', method='xml')
+ def feed(self, id=None):
+ if id:
+ link = self.data.get(id)
+ if not link:
+ raise cherrypy.NotFound()
+ return template.render('info.xml', link=link)
+ else:
+ links = sorted(self.data.values(), key=operator.attrgetter('time'))
+ return template.render(links=links)
+
def main(filename):
# load data from the pickle file, or initialize it to an empty list
@@ -113,7 +110,7 @@
fileobj.close()
cherrypy.engine.on_stop_engine_list.append(_save_data)
- # Some global configuration; note that this could be moved into a
+ # Some global configuration; note that this could be moved into a
# configuration file
cherrypy.config.update({
'request.throw_errors': True,
diff --git a/examples/tutorial/geddit/templates/index.html b/examples/tutorial/geddit/templates/index.html
--- a/examples/tutorial/geddit/templates/index.html
+++ b/examples/tutorial/geddit/templates/index.html
@@ -5,17 +5,24 @@