From 32091201964ca5f276bc3476444905c0bd8226bc Mon Sep 17 00:00:00 2001 From: Hidden Z Date: Sat, 9 Oct 2010 19:43:33 +0000 Subject: [PATCH] Add builder This is an initial implementation of hosts.txt builder service. --- builder | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 builder diff --git a/builder b/builder new file mode 100755 index 0000000..c838e83 --- /dev/null +++ b/builder @@ -0,0 +1,21 @@ +#!/usr/bin/python + +import os +import sys + +# django setup +DJANGO_SETTINGS_MODULE = 'settings' +DJANGO_PROJECT_PATH = 'web' +sys.path.insert(1, DJANGO_PROJECT_PATH) +os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_MODULE +from web.postkey.models import i2phost + +# result hosts.txt +hostsfile = 'hosts.txt' + +f = open(hostsfile, 'w') +# select name and hash for all activated hosts +l = i2phost.objects.filter(activated=True).values('name', 'b64hash') +for entry in l: + f.write(entry['name'] + '=' + entry['b64hash']) +f.close()