I've been trying to fix this all day.
I'm working on a wiki as a learning exercise. I have a template called
index html:
$def with (page)
<h1>$page.page_title</h1>
<p>$page.page_content</p>
which gets called by the class view_page:
class view_page:
def GET(self, name):
myvar = dict(page_title='%s' % name)
page = db.select('page', myvar)
if page:
return render.view(page)
else:
raise web.seeother('/create/%s' % name)
my sqlite table:
CREATE TABLE "page" ("page_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT
NULL , "page_content" VARCHAR, "page_title" VARCHAR)
I have a sample page: page_id=1, page_title="first_page" and
page_content="this is some sample content".
When I go to localhost:8080/first_page I get the error:
IterBetter instance has no attribute 'page_title'
I know that the page object has the attribute page_title and
page_content. I've read the cookbook and the tutorial several times.
Is this not the right usage?:
myvar = dict(column='%s' % othervar)
query = db.select('tablename', myvar)
return render.templatename(query)
templatename.html:
$def with (query)
<p>$query.column</p>
Thanks again.
-Alan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---