En Tue, 13 May 2008 15:10:21 -0300, Victor Subervi
<[EMAIL PROTECTED]> escribió:
I remember why I had the number with the getpic. It is because I display
several of these images on a single page, and apparently I cannot call
the
same script and get more than one image from an HTML page.
That's not true. If you still have the example I posted a few weeks ago,
you can use this script to show a full listing of all uploaded pictures.
It's a small variation of album.py.
I think you were saving the pictures on disk - DON'T do that. It's
unnecesary, wastes time and disk space, and if not done properly one
request interferes with the other.
--
Gabriel Genellina
#!/usr/bin/python
"Full listing (all pictures)"
import cgi
import sqlite3
conn = sqlite3.connect("demo.db")
cursor = conn.cursor()
sql = "select id, title, description from album order by id"
cursor.execute(sql)
lines = []
for row in cursor.fetchall():
id, title, description = row
lines.append("<h2>%s</h2>"
"<p>%s<br>"
" <img src='getpic.py?id=%s'>"
"</p>" % (cgi.escape(title),
cgi.escape(description),
id))
conn.close()
print "Content-Type: text/html"
print "Pragma: no-cache"
print "Cache-Control: no-cache"
print
print "<html><head><title>Picture album (full)</title></head>"
print "<body>"
print "<h1>Picture album</h1>"
if lines:
print "\n".join(lines)
else:
print "No pictures yet."
print "<p>You can <a href='upload.py'>upload a new picture</a>.</p>"
print "</body></html>"
--
http://mail.python.org/mailman/listinfo/python-list