1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-01-22 12:34:17 +00:00

py-i2phosts-builder: split queryset

Just for improve readability.
This commit is contained in:
Hidden Z 2010-10-26 17:57:59 +00:00
parent 8bdae565a5
commit a3b8128002

View File

@ -14,8 +14,11 @@ from web.postkey.models import i2phost
hostsfile = 'hosts.txt' hostsfile = 'hosts.txt'
f = open(hostsfile, 'w') f = open(hostsfile, 'w')
# select name and hash for all activated hosts # get activated hosts
l = i2phost.objects.filter(activated=True).values('name', 'b64hash') qs = i2phost.objects.filter(activated=True)
# select theirs name and base64 hash
l = qs.values('name', 'b64hash')
# write final hosts.txt-format file
for entry in l: for entry in l:
f.write(entry['name'] + '=' + entry['b64hash'] + '\n') f.write(entry['name'] + '=' + entry['b64hash'] + '\n')
f.close() f.close()