I tried the following view:

{{extend 'layout.html'}}
<h1>This is the test/show_periods.html template</h1>

{{for period in periods:}}
    <TR>{{period}}</TR>
   {{ subperiods = db(db.subperiod.period=period.id).select()}}
     {{for subperiod in subperiods:}}
         <TR>{{subperiod}}</TR>
          {{pass}}
    {{pass}}

and the following method:

def show_periods():
     periods=SQLTABLE(db().select(db.period.ALL))
     return dict(periods=periods)

I does not work, what does I get wrong? Apologies, if this look
staighforward.
thanks

Error traceback


Traceback (most recent call last):
  File "/home/francois/web2py/gluon/restricted.py", line 105, in
restricted
    ccode = compile(code.replace('\r\n', '\n'), layer, 'exec')
  File "/home/francois/web2py/applications/cookbook4/views/test/
show_periods.html", line 42

SyntaxError: keyword can't be an expression



In file: /home/francois/web2py/applications/cookbook4/views/test/
show_periods.html


response.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//
EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>\n<html
xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">\n<head>
\n<meta http-equiv="content-type" content="text/html; charset=utf-8" />
\n<meta name="keywords" content="',escape=False)
response.write(response.keywords)
response.write('" />\n<meta name="description"
content="',escape=False)
response.write(response.description)
response.write('" />\n<title>',escape=False)
response.write(URL(r=request))
response.write('</title>\n<link type="text/css" rel="stylesheet"
href="/',escape=False)
response.write(request.application)
response.write('/static/textarea/SyntaxHighlighter.css"></link>
\n<style>\ndiv.fluid { width: 93% !important; }\n div.fixed { width:
800px !important; }\n* { margin: 0em; padding: 0em; }\n body
{ background-color: #fff; color: #585858; font-size: 10pt; font-
family: georgia, serif; }\n h1,h2,h3,h4,h5,h6 { font-weight: normal;
letter-spacing: -1px; }\n h2,h3,h4,h5,h6 { color: #185360; }\n
br.clear { clear: both; }\n img { padding: 3px; border: solid 1px
#e1e1e1; }\n img.icon { border: 0px; vertical-align: middle; }\n
img.floatTL { float: left; margin-right: 1.5em; margin-bottom: 1.5em;
margin-top: 0.5em; }\n a { text-decoration: none; color: #FF5C1F; }\n
a:hover { text-decoration: underline; }\n textarea { font-family:
courier; }\n ul { margin-left: 1.5em; }\n li { line-height: 1.5em; }\n
dd { text-decoration: bold; }\n dt { text-decoration:none; margine-
left: +10em; }\n p { line-height: 1.8em; }\n table, tr, td { text-
align: left; vertical-align: top; } \n #header { width:100%; height:
48px; background: #195866 url(\'/',escape=False)
response.write(request.application)
response.write("/static/title.png') repeat-x; }\n #header_inner
{ position: relative; width: 800px; height:36px; margin: 0 auto; }\n
#header_lite { width:100%; height:36px; background: #440000 url
('/",escape=False)
response.write(request.application)
response.write('/static/title.png\') repeat-x; }\n #header_inner_lite
{ position: relative; width: 800px; height: 36px; margin: 0 auto; }\n /
* Logo */\n #logo { position: absolute; bottom: 0.6em; }\n #logo h1
{ display: inline; color: #fff; font-size: 1.8em; }\n #logo h2
{ display: inline; color: #fff; font-size: 1.8em; }\n /* Menu */\n
#menu { position: absolute; right: 0em; bottom: 0em; }\n #menu ul
{ list-style: none; }\n #menu li { float: left; }\n #menu li a
{ margin-left: 0.5em; display: block; padding: 0.5em 0.5em 0.5em
0.5em; background: #fff repeat-x; color: #185360; font-weight: bold;
font-size: 1.0em; text-decoration: none;}\n// #menu li a.inactive
{ background: #FF6C1F repeat-x; color: #fff; border: solid 1px
#DB7623; border-top: solid 1px #FBA653; }\n#menu li a.inactive
{ background: transparent; color: #FF5C1F; border: solid 0px #185360;
border-top: solid 0px #185360; }\n /* Main */\n #main { background:
#fff 0px 1px repeat-x; }\n #main_inner p { text-align: justify; margin-
bottom: 2.0em; }\n #main_inner ul { margin-bottom: 2.0em; }\n
#main_inner { position: relative; width: 800px; margin: 0 auto;
padding-top: 1.0em; }\n #main_inner h1 { border-bottom: dotted 1px
#E1E1E1; position: relative; font-size: 2.1em; padding-bottom: 0.1em;
margin-bottom: 0.8em; }\n #main_inner .post { position: relative; }\n
#main_inner .post h3 { position: relative; font-size: 1.7em; padding-
bottom: 1.2em; }\n #main_inner .post ul.post_info { list-style: none;
position: absolute; top: 3em; font-size: 0.8em; }\n #main_inner .post
ul.post_info li { background-position: 0em 0.2em; background-repeat:
no-repeat; display: inline; padding-left: 18px; }\n /* Flash */\n
#flash { width: 600px; margin: 0 auto; text-align: center; clear:
both; border: 1px #000000; background-color: #FF5C1F; color: white;
margin-top: 0.0em; margin-bottom: 1.0em; padding-top: 1.0em; padding-
bottom: 1.0em; }\n /* Footer */\n #footer { width: 800px; margin: 0
auto; text-align: center; clear: both; border-top: dotted 1px #E1E1E1;
margin-top: 1.0em; margin-bottom: 1.5em; padding-top: 1.0em; }\n /*
Search */\n input.button { background: #FF6C1F repeat-x; color: #fff;
border: solid 1px #DB7623; font-weight: bold; font-size: 0.8em;
height: 2.0em; }\n input.text { border: solid 1px #F1F1F1; font-size:
1.0em; padding: 0.25em 0.25em 0.25em 0.25em; }\n /* LAYOUT - 3 COLUMNS
*/\n /* Primary content */\n #primaryContent_3columns { position:
relative; margin-right: 34em; }\n #columnA_3columns { position:
relative; float: left; width: 100%; margin-right: -34em; padding-
right: 2em; }\n /* Secondary Content */\n #secondaryContent_3columns
{ float: right; }\n #columnB_3columns { width: 13.0em; float: left;
padding: 0em 2em 0.5em 2em; border-left: dotted 1px #E1E1E1; }\n
#columnC_3columns { width: 13.0em; float: left; padding: 0em 0em 0.5em
2em; border-left: dotted 1px #E1E1E1; }\n /* LAYOUT - 2 COLUMNS */\n /
* Primary content */\n #primaryContent_2columns { position: relative;
margin-right: 17em; }\n #columnA_2columns { position: relative; float:
left; width: 100%; margin-right: -17em; padding-right: 2em; }\n /*
Secondary Content */\n #secondaryContent_2columns { float: right; }\n
#columnC_2columns { width: 13.0em; float: left; padding: 0em 0em 0.5em
2em; border-left: dotted 1px #E1E1E1; }\n /* LAYOUT - COLUMNLESS */\n /
* Primary content */\n #primaryContent_columnless { position:
relative; }\n #columnA_columnless { position: relative; width: 100%; }
\n</style>\n<script type="text/javascript">\n<!--\nfunction popitup
(url) {\nnewwindow=window.open(url,\'name\',\'height=400,width=600\');
\nif (window.focus) {newwindow.focus()}\nreturn false;\n}\nfunction
collapse(name) { if\n(this.document.getElementById
(name).style.display=="none")\n(this.document.getElementById
(name).style.display="block") ;\nelse (this.document.getElementById
(name).style.display="none") ; }\n//-->\n</script>\n</head>\n<body>
\n<div id="header">\n <div id="header_inner" class="fixed">\n   <div
id="logo">\n     <h1><a href="">[web2py]</a></h1>\n
<h2>',escape=False)
response.write(request.application)
response.write('</h2>\n   </div>\n   ',escape=False)
if response.menu:
    response.write('\n   <div id="menu">\n   <ul>\n    ',escape=False)
    for _name,_active,_link in response.menu:
        response.write('\n    <li><a href="',escape=False)
        response.write(_link)
        response.write('" ',escape=False)
        if not _active:
            response.write('class="inactive"',escape=False)
            pass
        response.write('>',escape=False)
        response.write(_name)
        response.write('</a></li>\n    ',escape=False)
        pass
    response.write('\n   </ul>\n   </div>\n   ',escape=False)
    pass
response.write('\n  </div>\n</div>\n<div id="main">\n  <div
id="main_inner" class="fixed">\n    <div
id="primaryContent_columnless">\n      <div id="columnA_columnless">
\n        ',escape=False)
if response.flash:
    response.write('\n        <div id="flash">',escape=False)
    response.write(response.flash)
    response.write('</div>\n        ',escape=False)
    pass
response.write('\n        \n<h1>This is the test/show_periods.html
template</h1>\n\n',escape=False)
for period in periods:
    response.write('\n    <TR>',escape=False)
    period
    response.write('</TR>\n   ',escape=False)
    subperiods = db(db.subperiod.period=period.id).select()
    response.write('\n     ',escape=False)
    for subperiod in subperiods:
        response.write('\n         <TR>',escape=False)
        subperiod
        response.write('</TR>\n          ',escape=False)
        pass
    response.write('\n    ',escape=False)
    pass
response.write('\n\n      </div>\n    </div>\n    <div id="footer"
class="fixed">\n      &copy; 2007, web2py Web Framework created by
Massimo Di Pierro\n    </div>\n  </div>\n</div>\n</body>\n</html>
\n',escape=False)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to