DenesL
unread,Dec 31, 2008, 11:23:47 AM12/31/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web2py Web Framework
I can't upload the patch file to the group but I can describe what it
does.
The patch allows python code to be re-used with a simple copy/paste
operation, which can otherwise get very frustrating when you have to
split it up to insert the double braces and "pass" at appropriate
locations to make it work in a view.
RULES: the code has to start with {{! and end with }} as the first
chars in a separate line,
the = is replaced by response.write only if it is the first non-blank
char in a line,
the original indentation is kept.
Example:
...
<td>{{!v=inp[f]
if hasattr(v,'xml'):
=v.xml()
else:
=v
a='test'
=a
}}</td>
</tr>
...
would end up as:
...
v=inp[f]
if hasattr(v,'xml'):
response.write(v.xml())
else:
response.write(v)
a='test'
response.write(a)
response.write('</td>\n</tr>',escape=False)
...
There is an obvious cost of parsing two additional regex rules.