return empty body when no main div (closes #541)

This commit is contained in:
juke 2011-03-11 10:53:29 +01:00
commit d092437ce6

View file

@ -16,7 +16,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
from weboob.tools.genericArticle import NoAuthorElement, try_remove from weboob.tools.genericArticle import NoAuthorElement, try_remove, NoneMainDiv
from .simple import SimplePage from .simple import SimplePage
class ArticlePage(SimplePage): class ArticlePage(SimplePage):
@ -28,7 +28,11 @@ class ArticlePage(SimplePage):
self.element_body_selector = "div.mna-body" self.element_body_selector = "div.mna-body"
def get_body(self): def get_body(self):
try:
element_body = self.get_element_body() element_body = self.get_element_body()
except NoneMainDiv:
return None
else:
try_remove(element_body, "div.mna-tools") try_remove(element_body, "div.mna-tools")
try_remove(element_body, "div.mna-comment-call") try_remove(element_body, "div.mna-comment-call")
try : try :