From ce6d9bdcd76d0b69e8f84431aa3e280e97d64cff Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Tue, 6 Mar 2012 20:22:26 +0100 Subject: [PATCH] Fix getting pastebin paste visiblity Pastebin somehow decided to use title instead of alt. They are wrong. That attribute should at least tell "Private" or "Public" to blind users. Well, another reason to use Weboob instead of their website! --- modules/pastebin/pages.py | 2 +- modules/pastebin/test.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/pastebin/pages.py b/modules/pastebin/pages.py index dfe38a33..91b7f1e9 100644 --- a/modules/pastebin/pages.py +++ b/modules/pastebin/pages.py @@ -51,7 +51,7 @@ class PastePage(LoginPage): paste.contents = self.parser.select(self.document.getroot(), '//textarea[@id="paste_code"]', 1, 'xpath').text visibility_text = self.parser.select(header, - '//div[@class="paste_box_line1"]//img', 1, 'xpath').attrib['alt'] + '//div[@class="paste_box_line1"]//img', 1, 'xpath').attrib['title'] if visibility_text.startswith('Public'): paste.public = True elif visibility_text.startswith('Private'): diff --git a/modules/pastebin/test.py b/modules/pastebin/test.py index 484d6969..e04000fb 100644 --- a/modules/pastebin/test.py +++ b/modules/pastebin/test.py @@ -56,6 +56,8 @@ class PastebinTest(BackendTest): p1 = self.backend.new_paste(None, title='ouiboube', contents=u'Weboob ¿¡', public=False) self.backend.post_paste(p1, max_age=600) assert p1.id + # not related to testing special chars, but check if the paste is + # really private since test_post() tests the contrary assert p1.public is False # this should use the raw method to get the contents