From 0afaac6633296077490afecbaf6930dfd2a760a9 Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Sat, 13 Jul 2013 08:47:15 +0100 Subject: [PATCH] Updates for PEP8. --- varnish.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/varnish.py b/varnish.py index aa803d3..5132be7 100755 --- a/varnish.py +++ b/varnish.py @@ -1,4 +1,5 @@ #!/usr/bin/python +"""Script to create a ACL file for inclusion within Varnish.""" import blocklist import sys @@ -6,18 +7,22 @@ import sys class VarnishBlockList(blocklist.BlockList): """New class to extend the main BlockList class for implementation with Varnish.""" def export(self): - """Exports blocklist addresses for use within Varnish.""" - print "acl block_list {" - for address in self.data.keys(): - print "\t\"%s\";" % address - print "}" + """Exports blocklist addresses for use within Varnish.""" + print "acl block_list {" + for address in self.data.keys(): + print "\t\"%s\";" % address + print "}" -if __name__ == "__main__": - blocklist = VarnishBlockList() +def main(): + """Main program loop.""" + block_list = VarnishBlockList() - blocklist.read("http://server1.example.com/default/blocks.txt") - blocklist.read("http://server2.example.com/default/blocks.txt") + block_list.read("http://server1.example.com/default/blocks.txt") + block_list.read("http://server2.example.com/default/blocks.txt") - blocklist.export() + block_list.export() sys.exit(0) + +if __name__ == "__main__": + main()