Τη Κυριακή, 2 Ιουνίου 2013 10:01:50 π.μ. UTC+3, ο χρήστης Giorgos Tzampanakis
έγραψε:
OK George, nd the rest fo the guys here it is the snippet of files.py
responsible to print the greek filenames:
for row in data:
(url, hits, host, lastvisit) = row
shorturl = url.replace( '/home/nikos/www/data/apps/', '' )
lastvisit = lastvisit.strftime('%A %e %b, %H:%M')
print('''
<form method="get" action="cgi-bin/files.py">
<tr>
<td> <center> <input type="submit"
name="shorturl" value="%s"> </td>
<td> <center> <font color=yellow size=5> %s
</td>
<td> <center> <font color=orange size=4> %s
</td>
<td> <center> <font color=silver size=4> %s
</td>
</tr>
</form>
''' % (shorturl, hits, host, lastvisit) )
and here is the the metrites.py snipper that calls files.py via subproccess to
run:
if page.endswith('.html'):
with open('/home/nikos/public_html/' + page, encoding='utf-8')
as f:
htmldata = f.read()
htmldata = htmldata % (quote, music)
template = htmldata + counter
elif page.endswith('.py'):
htmldata = subprocess.check_output(
'/home/nikos/public_html/cgi-bin/' + page )
template = htmldata.decode('utf-8') + counter
print( template )
--
http://mail.python.org/mailman/listinfo/python-list