Updates for PEP8.

This commit is contained in:
Scott Wallace 2013-07-13 08:47:15 +01:00
parent 396501a0f4
commit 0afaac6633

View file

@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
"""Script to create a ACL file for inclusion within Varnish."""
import blocklist import blocklist
import sys import sys
@ -6,18 +7,22 @@ import sys
class VarnishBlockList(blocklist.BlockList): class VarnishBlockList(blocklist.BlockList):
"""New class to extend the main BlockList class for implementation with Varnish.""" """New class to extend the main BlockList class for implementation with Varnish."""
def export(self): def export(self):
"""Exports blocklist addresses for use within Varnish.""" """Exports blocklist addresses for use within Varnish."""
print "acl block_list {" print "acl block_list {"
for address in self.data.keys(): for address in self.data.keys():
print "\t\"%s\";" % address print "\t\"%s\";" % address
print "}" print "}"
if __name__ == "__main__": def main():
blocklist = VarnishBlockList() """Main program loop."""
block_list = VarnishBlockList()
blocklist.read("http://server1.example.com/default/blocks.txt") block_list.read("http://server1.example.com/default/blocks.txt")
blocklist.read("http://server2.example.com/default/blocks.txt") block_list.read("http://server2.example.com/default/blocks.txt")
blocklist.export() block_list.export()
sys.exit(0) sys.exit(0)
if __name__ == "__main__":
main()