I have a controller defining a few buttons. I have changed the ' return'
part as commented below just to see whether it makes a difference. But it
does not.
Using this controller and view (index.html) results in an error:
File "/home/js/web2py/applications/doccenter/views/default/index.html",line
103, in <module>
NameError: name 'browse' is not defined
line 103 contains
response.write(browse)
I have copied the html file to index1.html.
If I change the controller to index1 it works without a problem.
I first thought it might be a browser cache problem, but clearing the cache
does not making a difference. I have tried this on three different browsers
with the same result.
This baffles me. How does one explain this?
def index():
# image =
IMG(_src='doccenter/static/images/doccenter.jpg',_alt='Documentation
Centre',
# _width="100%")
browse = A(T("Browse"), _class = 'btn btn-large btn-info',
_style="width:50%;",
_href = URL(r = request, c = 'default',
f = 'browse'))
add_location = A(T("Add location"), _class = 'btn btn-large btn-info',
_style="width:50%;",
_href = URL(r = request, c = 'default',
f = 'add_location'))
add_document = A(T("Add document"), _class = 'btn btn-large btn-info',
_style="width:50%;",
_href = URL(r = request, c = 'default',
f = 'add_document'))
add_category = A(T("Add category"), _class = 'btn btn-large btn-info',
_style="width:50%;",
_href = URL(r = request, c = 'default',
f = 'add_category'))
search = A(T("Search"), _class = 'btn btn-large btn-info', _style=
"width:50%;",
_href = URL(r = request, c = 'default',
f = 'search'))
items_per_category = A(T("Add category"), _class = 'btn btn-large
btn-info', _style="width:50%;",
_href = URL(r = request, c = 'default',
f = 'items_per_category'))
# return locals()
return dict(search = search, browse = browse, items_per_category
=items_per_category
,
add_location = add_location, add_category = add_category,
add_document = add_document)
And a view:
{{extend "layout.html"}}
<style>
.bottom-three {
margin-bottom: 50%;
}
.center
{
margin-left:auto;
margin-right:auto;
width:70%;
background-color:#b0e0e6;
}
</style>
<div class="row-fluid"
class="hero-unit"
style =
"background:url(/doccenter/static/images/doccenter.jpg);
background-size:100%;
background-repeat:no-repeat;
padding-top:40px;">
<div class="span2">
{{=browse}}
</div>
<div class="span2">
{{=search}}
</div>
<div class="span2">
{{=add_location}}
</div>
<div class="span2">
{{=add_category}}
</div>
<div class="span2">
{{=add_document}}
</div>
<div class="span2">
{{=items_per_category}}
</div>
<p class="bottom-three"></p>
<div class="geel">
<h3 style="COLOR:yellow; text-align:center;">
CREST's Documentation Centre contains a wealth of valuable
documents for research purposes
</h3>
</div>
</div>
Regards
Johann
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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.