I'm trying to make IMDbPY more robust to errors: actually even a small
change to IMDb's web site can trigger an exception in our parsers.

I've committed to the SVN [1] a new version, with support for logging [2],
and I've made some small changes to the DOM parser (see the class
imdb.parser.http.utils.DOMParserBase) so that most of the errors are
caught and (hopefully) nicely handled.
The default setting are in the imdb._logging module.

Notice that the code still raises some exceptions: when you're in a
situation that is not recoverable, you're expected to explode. :-)
On the other hand, every time something goes wrong parsing/processing
the data, a message is logged an the code tries to go on.

Things to do and sill open to debate:
- I really do hope that this will not slow down the stream of bug
  reports. :-)
- actually the logs are written to standard error; in the future there
  will be a mean to override this (it can already be done in code) and
  to set things like logLevel, maybe in the .INI file.
- I'm not completely sure about how we should/could integrate the logging
  system with the "warnings" module already used here and there.
  "warnings" has the nice feature that every message is issued just one
  time, and there are spots in with this behaviour is useful.
- the root logger for IMDbPY is called "imdbpy"; right now the only
  used logger is "imdbpy.parser.http.domparser" (scopes are funny and
  useful! ;-)
- so far only the "http" parsers are affected: the next on the list
  are the "mobile" parsers, and maybe something here and there in the
  main code (where I don't think there will be much need).


As usual, any help is greatly appreciated!

+++
[1] http://imdbpy.sf.net/?page=download#svn
[2] the Python logging package is the best thing since Python itself. ;-)
    See the docs:
      http://docs.python.org/library/logging.html
-- 
Davide Alberani <davide.alber...@gmail.com> [GPG KeyID: 0x465BFD47]
http://www.mimante.net/

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Imdbpy-devel mailing list
Imdbpy-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/imdbpy-devel

Reply via email to