The complete commented code is: def show(): > "shows a wiki page" > * # request.args(0) should receive an ID for the page you want to > 'whow' > # you query the database to fetch the page row* > this_page = db.page(request.args(0)) or redirect(URL('index')) > * # for this action '/show/' we want every comment to have page_id > reference field defaults to the current page* > db.comment.page_id.default = this_page.id > *# we create a form for the comments only if user is logged in, else > the form is None* > form = crud.create(db.comment) if auth.user else None > * # here we are fetching the existing comments for this page* > pagecomments = db(db.comment.page_id==this_page.id).select() > * # now we return some objects to be rendered in the view* > return dict(page=this_page, comments=pagecomments, form=form)
-- Bruno Rocha [http://rochacbruno.com.br]