I have walked through the component example in the book, and am now
attemmpting to get this to work on a wiki page.
The first setup works
*In default.py
*[code]
def index():
# return auth.wiki()
return dict()
def post():
findname = request.args[0]
return dict(specs=db(db.specs.name==findname).select())
[/code]
*In default/index.html
*[code]
{{extend 'layout.html'}}
{{#=content}}
{{=LOAD('default','post.load',args=['merlin'],target='spec',ajax=True)}}
[/code]
*In views/default/index.html
*[code]
{{extend 'layout.html'}}
{{#=content}}
{{=LOAD('default','post.load',args=['merlin'],target='spec',ajax=True)}}
[/code]
*In views/default/post.load
*[code]
{{#extend 'layout.html'}}
{{for row in specs:}}
<div>
<table border="1">
<tr><td colspan="2">Specifications</td></tr>
<tr><td>Aircraft</td><td>{{=row.name}}</td></tr>
<tr><td>Wing Span</td><td>{{=row.wingspan}}</td></tr>
</table>
</div>
{{pass}}
[/code]
The Page shows correctly, and when I view the page source I see;
…
<script type="text/javascript"><!--
web2py_component('/test/default/post.load/merlin','spec');
//--></script><div id="spec">loading...</div>
…
Now I change to the wiki style
*In default.py
*[code]
def index():
# return auth.wiki()
return dict()
def post():
findname = request.args[0]
return dict(specs=db(db.specs.name==findname).select())
[/code]
*In default/index.html
*[code]
{{extend 'layout.html'}}
{{#=content}}
{{=LOAD('default','post.load',args=['merlin'],target='spec',ajax=True)}}
[/code]
*In views/default/index.html
*[code]
{{extend 'layout.html'}}
{{#=content}}
{{=LOAD('default','post.load',args=['merlin'],target='spec',ajax=True)}}
[/code]
Index Wiki page has this content
[code]
## Index
page content
[[NEWLINE]]
@{component:LOAD('default','post.load',args=['merlin'],target='spec',ajax=True)}
[/code]
and now the page shows
Index
Page content
ERROR: list index out of range
What am I doing wrong?
Thanks,
Phil
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.