On 10/18/06, John Henry <[EMAIL PROTECTED]> wrote:
> class Root(controllers.RootController):
>     @expose(template="wiki20.templates.page")
>     def index(self):
>         import time
>         log.debug("Happy TurboGears Controller Responding For Duty")
>         return dict(now=time.ctime())
>
> @expose("wiki20.templates.page")
> def index(self, pagename="FrontPage"):
>     page = Page.byPagename(pagename)
>     content = publish_parts(page.data,
>                             writer_name="html")["html_body"]
>     return dict(data=content, page=page)

The error message is that the template is expecting a variable named
'page'. The index method that was called (the one under Root) was
providing only the 'now' variable to the template. You want to replace
the index method in the Root class not add a function outside of any
class.

The above should be:

class Root(controllers.RootController):
    @expose("wiki20.templates.page")
    def index(self, pagename="FrontPage"):
        page = Page.byPagename(pagename)
        content = publish_parts(page.data,
                                writer_name="html")["html_body"]
        return dict(data=content, page=page)

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to