Discussion:
[bottlepy] <% %> not working
Victor Zambrano
2016-05-06 14:28:48 UTC
Permalink
Hello everyone, i am somewhat new to python, and quite new too bootle.

Actually i am strugling but on my way building my app.

If i type single python lines precceded with %, everything is ok, but the
next no:

<%
import sqlite3
conn=sqlite3.connect('data.db')
cur=conn.cursor()
cur.execute('''SELECT * FROM pacientes ORDER BY fecha ASC''')
data=cur.fetchall()
cur.close()
%>

Browser raises error


Exception:

SyntaxError('invalid syntax', ('C:\\blahblah\archive.tpl', 8, 1, '%>\n'))


File "C:\blahblah\archive.tpl", line 8
%>
^
SyntaxError: invalid syntax


What is going on ? Tnx in advance
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Victor Zambrano
2016-05-10 15:11:07 UTC
Permalink
*UPDATE:*
Actually i found the answer. The default template format comes from
SimpleTemplate, which does not use <% block%>. To change the template
engine, we must import any of the others included like jinja or mako, each
one with its own format to include python code.

El viernes, 6 de mayo de 2016, 10:02:56 (UTC-4:30), Victor Zambrano
Post by Victor Zambrano
Hello everyone, i am somewhat new to python, and quite new too bootle.
Actually i am strugling but on my way building my app.
If i type single python lines precceded with %, everything is ok, but the
<%
import sqlite3
conn=sqlite3.connect('data.db')
cur=conn.cursor()
cur.execute('''SELECT * FROM pacientes ORDER BY fecha ASC''')
data=cur.fetchall()
cur.close()
%>
Browser raises error
SyntaxError('invalid syntax', ('C:\\blahblah\archive.tpl', 8, 1, '%>\n'))
File "C:\blahblah\archive.tpl", line 8
%>
^
SyntaxError: invalid syntax
What is going on ? Tnx in advance
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.

---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...