[support-system] Non existing chapters reseult in traceback when searching webbibles

Bug #1194730 reported by Andreas Preikschat
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenLP
Status tracked in Trunk
2.0
Fix Released
High
Phill
Trunk
Invalid
High
Phill

Bug Description

Hello,

http://support.openlp.org/issues/2006

====PART 1====

1) Register the New Living Translation from biblegateway.
2) Search 2 Samuel 25

Result:

Traceback (most recent call last):
  File "/home/andreas/Projects/OpenLP/trunk/openlp/plugins/bibles/lib/mediaitem.py", line 656, in onQuickSearchButton
    self.search_results = self.plugin.manager.get_verses(bible, text)
  File "/home/andreas/Projects/OpenLP/trunk/openlp/plugins/bibles/lib/manager.py", line 300, in get_verses
    return self.db_cache[bible].get_verses(reflist, show_error)
  File "/home/andreas/Projects/OpenLP/trunk/openlp/plugins/bibles/lib/http.py", line 608, in get_verses
    search_results = self.get_chapter(book, reference[1])
  File "/home/andreas/Projects/OpenLP/trunk/openlp/plugins/bibles/lib/http.py", line 636, in get_chapter
    return handler.get_bible_chapter(self.download_name, book, chapter)
  File "/home/andreas/Projects/OpenLP/trunk/openlp/plugins/bibles/lib/http.py", line 245, in get_bible_chapter
    self._clean_soup(div)
  File "/home/andreas/Projects/OpenLP/trunk/openlp/plugins/bibles/lib/http.py", line 127, in _clean_soup
    self._remove_elements(tag, 'sup', 'crossreference')
  File "/home/andreas/Projects/OpenLP/trunk/openlp/plugins/bibles/lib/http.py", line 86, in _remove_elements
    all_tags = parent.find_all(tag, class_)
AttributeError: 'NoneType' object has no attribute 'find_all'

Expected:
Nothing should happen, because this chapter does not exist.

===PART2===
1) Search for 2 Samuel 1:88

Result:
Traceback (most recent call last):
  File "/home/andreas/Projects/OpenLP/trunk/openlp/plugins/bibles/lib/mediaitem.py", line 656, in onQuickSearchButton
    self.search_results = self.plugin.manager.get_verses(bible, text)
  File "/home/andreas/Projects/OpenLP/trunk/openlp/plugins/bibles/lib/manager.py", line 300, in get_verses
    return self.db_cache[bible].get_verses(reflist, show_error)
  File "/home/andreas/Projects/OpenLP/trunk/openlp/plugins/bibles/lib/http.py", line 608, in get_verses
    search_results = self.get_chapter(book, reference[1])
  File "/home/andreas/Projects/OpenLP/trunk/openlp/plugins/bibles/lib/http.py", line 636, in get_chapter
    return handler.get_bible_chapter(self.download_name, book, chapter)
  File "/home/andreas/Projects/OpenLP/trunk/openlp/plugins/bibles/lib/http.py", line 252, in get_bible_chapter
    verse_list = self._extract_verses(span_list)
  File "/home/andreas/Projects/OpenLP/trunk/openlp/plugins/bibles/lib/http.py", line 149, in _extract_verses
    c_verse, c_text = self._extract_verse(child)
  File "/home/andreas/Projects/OpenLP/trunk/openlp/plugins/bibles/lib/http.py", line 101, in _extract_verse
    elif tag.get('class')[0] == "versenum" or tag.get('class')[0] == 'versenum mid-line':
TypeError: 'NoneType' object has no attribute '__getitem__'

Expected:
Nothing, the verse does not exist.

NOTE:
The tracebacks are ONLY shown, when the chapter was not already downloaded!

Related branches

tags: added: support-system
tags: added: regression
Revision history for this message
Phill (phill-ridout) wrote :

I can confirm this with 2.0 Trunk

Revision history for this message
Phill (phill-ridout) wrote :

Ok, So I can only confirm part 1. Part 2 does not seem to be an issue in 2.0 or trunk!

Revision history for this message
Phill (phill-ridout) wrote :

After many repeat attempts I cannot trigger either parts in trunk

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.