Hi all,
I am very new to both Python and TurboGears, so bear with me. I am
stepping through the tutorial. I am using the written one with the
video as a back up guide. I am on the WikiWord section on page four.
Here is my controller file:
from model import Page, hub
from docutils.core import publish_parts
import turbogears
import cherrypy
import re
wikiwords = re.compile(r"\b([A-Z]\w+[A-Z]+\w+)")
class Root:
@turbogears.expose(html="wiki20.templates.page")
def index(self, pagename="FrontPage"):
page = Page.byPagename(pagename)
content = publish_parts(page.data,
writer_name="html")["html_body"]
root = str(turbogears.url("/"))
content = wikiwords.sub(r'<a href="%s\1">\1</a>' % root,
content)
content = content.encode("utf8")
return dict(data=content, pagename=page.pagename)
@turbogears.expose(html="wiki20.templates.edit")
def edit(self, pagename):
page = Page.byPagename(pagename)
return dict(pagename=page.pagename, data=page.data)
@turbogears.expose()
def save(self, pagename, data, submit):
hub.begin()
page = Page.byPagename(pagename)
page.data = data
hub.commit()
hub.end()
turbogears.flash("Changes saved!")
raise cherrypy.HTTPRedirect("/%s" % pagename)
# raise cherrypy.HTTPRedirect("/?pagename=%s" % pagename)
@turbogears.expose(html="wiki20.templates.page")
def default(self, pagename):
return self.index(pagename)
---------------------------------------
Here is the error message I am getting:
2005/10/16 04:12:11 INFO Traceback (most recent call last):
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/CherryPy-2.1.0_betadev-py2.4.egg/cherrypy/_cphttptools.py",
line 276, in run
main()
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/CherryPy-2.1.0_betadev-py2.4.egg/cherrypy/_cphttptools.py",
line 498, in main
body = page_handler(*args, **cherrypy.request.paramMap)
File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/TurboGears-0.5.1-py2.4.egg/turbogears/controllers.py",
line 93, in newfunc
output = func(self, *args, **kw)
File "/Users/jeremy/wiki20/wiki20/controllers.py", line 15, in index
root = str(turbogears.url("/"))
AttributeError: 'module' object has no attribute 'url'
---------------------------------------
Anyone have any ideas?
Thanks!
Jeremy