Browse Source

py-i2phosts-builder: split queryset

Just for improve readability.
pull/1/head
Hidden Z 14 years ago
parent
commit
a3b8128002
  1. 7
      py-i2phosts-builder

7
py-i2phosts-builder

@ -14,8 +14,11 @@ from web.postkey.models import i2phost @@ -14,8 +14,11 @@ from web.postkey.models import i2phost
hostsfile = 'hosts.txt'
f = open(hostsfile, 'w')
# select name and hash for all activated hosts
l = i2phost.objects.filter(activated=True).values('name', 'b64hash')
# get activated hosts
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:
f.write(entry['name'] + '=' + entry['b64hash'] + '\n')
f.close()

Loading…
Cancel
Save