Menu

#70 Python error in My Votes when title is missing

closed-fixed
MartyD
5
2009-07-04
2009-07-02
MartyD
No

From the Help Desk, a user reported getting the Python error below. Investigation showed this to be due to My Votes list containing a vote for a since-deleted title. Regardless of whether that record should be present, the display should handle this situation gracefully instead of producing an exception and Python trace.

"<type 'exceptions.IndexError'> Python 2.5: /usr/bin/python Wed Jul 1 23:38:32 2009

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

/var/www/cgi-bin/myvotes.cgi in ()
84 color = 0
85 while record:
86 PrintRecord(record, color)
87 color = color ^ 1
88 record = result.fetch_row()
PrintRecord = <function PrintRecord at 0xb7b7609c>, record = ((6233L, 183093L, 8689L, 9L),), color = 0

/var/www/cgi-bin/myvotes.cgi in PrintRecord(record=((6233L, 183093L, 8689L, 9L),), eccolor=0)
32 title = SQLloadTitle(record[0][1])
33 print "<td>%d</td>" % (record[0][3])
34 print '<td><a href="http:/%s/title.cgi?%d">%s</a></td>' % (HTFAKE, title[TITLE_PUBID], title[TITLE_TITLE])
35 print '<td>%s</td>' % (title[TITLE_TTYPE])
36 print '<td>%s</td>' % (title[TITLE_YEAR])
global HTFAKE = '/www.isfdb.org/cgi-bin', title = [], global TITLE_PUBID = 0, global TITLE_TITLE = 1

<type 'exceptions.IndexError'>: list index out of range "

Discussion

  • MartyD

    MartyD - 2009-07-02
    • assigned_to: nobody --> marty-d
     
  • MartyD

    MartyD - 2009-07-03

    Fixed by the commit of biblio/myrecent.py on 03-Jul-2009. Modified the My Votes display's query to join over the titles table, effectively excluding any votes for titles that no longer exists. This per discussion at http://www.isfdb.org/wiki/index.php/ISFDB:Proposed_Interface_Changes#Question_1:_What_should_the_display_do.3F. Also modified PrintRecord() to handle the possibility of being asked to display a vote for a non-existent title, should it become desirable to change the behavior to present information about votes for deleted titles (the join over titles could be removed).

     
  • MartyD

    MartyD - 2009-07-03
    • status: open --> open-fixed
     
  • Ahasuerus

    Ahasuerus - 2009-07-04

    Fixed in r2009-07.

     
  • Ahasuerus

    Ahasuerus - 2009-07-04
    • status: open-fixed --> closed-fixed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB