On Mon, Nov 24, 2008 at 2:21 PM, Peter van der Does <[EMAIL PROTECTED]> wrote: > On Mon, 24 Nov 2008 11:00:59 -0500 > Peter van der Does <[EMAIL PROTECTED]> wrote: > >> I wrote my 1st Python program and it works as I want it to work but >> ,IMHO, it looks horrible.
> OK, I put the code here: > > http://pdoes.pastebin.com/m47109194 I would work on breaking this up into functions. The main problem with this is the need to access the logger. I would make that a module (global) variable so it is accessible to each function without being passed as a parameter. Then some possible functions are - read and parse command line options, returning the options object. (You might want to combine the command-line options and the Config options into a single configuration object that can be passed as a single parameter. A couple of ways to do that: Set the command-line options into the Config object yourself http://www.red-dove.com/python_config.html#integrating-with-command-line-options http://cfgparse.sourceforge.net/ - read the banned IP list, returning spamip - setup FTP, returning the ftp object - fetch the access log - fetch .htaccess - parse the access log, returning ip_list - process the .htaccess file Kent _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
