Add try...finally block to file parsing

- Add try...finally block to ensure file is closed as before only non-gzip
  files would get closed. This also removed the duplication of calling
  parse_file.
Add warning when a file parse failed previously

- Add db check for zero parsed lines when current log file is found in
  ProcessedFiles table, and log a warning instead of an info message
  informing of a skipped file so that the previous problem is not hidden.
- Change "omitting" to "skipping" for ease of understanding.
Correct line number reporting when parsing

- Change 'line_no' to 'index' to show its real meaning and then derive
  actual line numbers from it by adding 1. This means that error messages
  and the StopLine column in ProcessedFiles will be more accurate and
  useful.
- Replace deprecated .has_key() with 'in'.
Revert add warning when a parse failed previously

- This paritially reverts commit 13cf04bee60a5cffca63165eda1cd032b5366653
- One warning should be enough. Raising the warning again would have made
  it harder to find the original problem.
Revert "Revert add warning when a parse failed previously"

This reverts commit b43b0c9554129080c5e6693ddd63a223f761dd27.
Improve parser log output

- Add initialization of 'unparsed' to False otherwise the 'elif unparsed'
  might have thrown a wobbly if it wasn't assigned.
- Change unparsed log message from WARN to INFO as only the initial
  failure to parse should be a WARN and INFO is consistent with other
  skipping messages.
- Change messages to be more consistent with surrounding messages in that
  they start with describing the action being performed rather than
  printing the filename.
Merge pull request #16 from apel/issue_7

File handling and line number reporting fixes