I'm afraid I can't see anything obviously wrong. Have you tried using
the latest version of TurboGears (from the preview section of the
website)?
Ed
On 7/4/06, Bucco <[EMAIL PROTECTED]> wrote:
>
> Here is my controllers.py:
>
> import turbogears
> import cherrypy
> import re
> from turbogears import controllers
> from model import Page, hub
> from docutils.core import publish_parts
> from sqlobject import SQLObjectNotFound
>
> wikiwords = re.compile(r"\b([A-Z]\w+[A-Z]+\w+)")
>
> class Root(controllers.Root):
> @turbogears.expose(html="wiki20.templates.page")
> def index(self, pagename="FrontPage"):
> try:
> page = Page.byPagename(pagename)
> except SQLObjectNotFound:
> raise cherrypy.HTTPRedirect(turbogears.url("/notfound",
> pagename= 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)
> 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, new):
> hub.begin()
> if new:
> page = Page(pagename=pagename, data=data)
> else:
> page = Page.byPagename(pagename)
> page.data = data
> hub.commit()
> hub.end()
> turbogears.flash("Changes saved!")
> raise cherrypy.HTTPRedirect(turbogears.url("/%s" % pagename))
> @turbogears.expose(html="wiki20.templates.page")
> def default(self, pagename):
> return self.index(pagename)
> @turbogears.expose(html="wiki20.templates.edit")
> def notfound(self, pagename):
> return dict(pagename=pagename, data="", new=True)
> @turbogears.expose(html="wiki20.templates.pagelist")
> def pagelist(self):
> pages = [page.pagename for page in
> Page.select(orderBy=Page.q.pagename)]
> return dict(pages=pages)
>
> I can't find the error. Here is the master.kid file I added the
> javascript to:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:py="http://purl.org/kid/ns#">
>
> <head py:match="item.tag=='{http://www.w3.org/1999/xhtml}head'">
> <meta content="text/html; charset=UTF-8" http-equiv="content-type"
> py:replace="''"/>
> <title py:replace="''">Your title goes here</title>
> <meta py:replace="item[:]"/>
> <script src="/turbogearsjs/MochiKit.js"/>
> <script type="text/javascript">
> function requestPageList() {
> d = loadJSONDoc("/pagelist?turbogearsfmt=json");
> d.addCallback(showPageList);
> }
>
> function showPageList(result) {
> pages = result["pages"];
> currentpagelist = UL(null,
> map(row_display, pages));
> replaceChildNodes("pagelist", currentpagelist);
> }
>
> function row_display(pagename) {
> return LI(null,
> A({"href": "/" + pagename},
> pagename));
> }
> </script>
> </head>
>
> <body py:match="item.tag=='{http://www.w3.org/1999/xhtml}body'">
>
> <div py:if="tg_flash" class="flash" py:content="tg_flash"></div>
>
> <div py:replace="item[:]"/>
>
> <p><a href="#" onclick="requestPageList()">View complete page
> list.</a></p>
> <div id="pagelist"></div>
> </body>
> </html>
>
> Thanks for any help ahead of time.
>
> :)
>
> SA
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---