fix int() error when list of bugs is blank

Review Request #100 — Created June 26, 2007 and submitted

Information

Review Board SVN (deprecated)
138

Reviewers

When bugs_closed is blank and a ReviewRequest is encoded by the JSON encoder, the following line throws an error:
bugs_closed = [int(b.strip()) for b in o.bugs_closed.split(',')]
''.split(',') returns (as documented) the original string in a list, being [''].  This is iterated (it contains an item) and is passed to int, thus int('') is called, throwing an error.

The fix shown works, but does add a little extra cruft to the line.  Perhaps this could be split over multiple lines or otherwise abstracted.

 
david
  1. Oops.  I ust committed a different fix for this which uses multiple lines, since that's a bit cleaner.
    1. No problem.  I learned about filter, which is enough for me.  Hooray Python!
  2.