356: Non-numeric bug numbers break issue display

markd*****@gmai***** (Google Code) (Is this you? Claim this profile.)
david
david
Jan. 14, 2008
What steps will reproduce the problem?
1. Add non-numberic characters to the "bugs" field.
2. Attempt to view the issue page will give a page with an error starting
with this:
ValueError at /r/7/
invalid literal for int() with base 10: 'bug'


The problem is in reviews/models.py, line 286:
   def get_bug_list(self):
       """
       Returns a sorted list of bugs associated with this review request.
       """
       bugs = re.split(r"[, ]+", self.bugs_closed)
286:   bugs.sort(cmp=lambda x,y: int(x) - int(y))
       return bugs

Some possible fixes:
 1. cmp function in sort is changed to be more general
 2. add try/except around bugs.sort.  bug lists with non-numeric characters
are unsorted.
 3. Extract just the numeric parts of each bug id before sorting.
david
#1 david
Fixed in SVN.  Thanks!
  • +Fixed
  • +Component-Reviews
  • +david
#2 cuv****@gmai***** (Google Code) (Is this you? Claim this profile.)
This bug also crops up in ReviewRequestDraft.get_bug_list(), and the exact same fix
will work too.
david
#3 david
Fixed again.  Thanks.