pastebin: Fix visibility detection
Private has been renamed to Unlisted, and Private is something else.
This commit is contained in:
parent
f48c81de53
commit
cf03138308
1 changed files with 5 additions and 5 deletions
|
|
@ -46,15 +46,15 @@ class PastePage(BasePastebinPage):
|
||||||
def fill_paste(self, paste):
|
def fill_paste(self, paste):
|
||||||
header = self.parser.select(self.document.getroot(),
|
header = self.parser.select(self.document.getroot(),
|
||||||
'id("content_left")//div[@class="paste_box_info"]', 1, 'xpath')
|
'id("content_left")//div[@class="paste_box_info"]', 1, 'xpath')
|
||||||
paste.title = self.parser.select(header,
|
paste.title = unicode(self.parser.select(header,
|
||||||
'//div[@class="paste_box_line1"]//h1', 1, 'xpath').text
|
'//div[@class="paste_box_line1"]//h1', 1, 'xpath').text)
|
||||||
paste.contents = self.parser.select(self.document.getroot(),
|
paste.contents = unicode(self.parser.select(self.document.getroot(),
|
||||||
'//textarea[@id="paste_code"]', 1, 'xpath').text
|
'//textarea[@id="paste_code"]', 1, 'xpath').text)
|
||||||
visibility_text = self.parser.select(header,
|
visibility_text = self.parser.select(header,
|
||||||
'//div[@class="paste_box_line1"]//img', 1, 'xpath').attrib['title']
|
'//div[@class="paste_box_line1"]//img', 1, 'xpath').attrib['title']
|
||||||
if visibility_text.startswith('Public'):
|
if visibility_text.startswith('Public'):
|
||||||
paste.public = True
|
paste.public = True
|
||||||
elif visibility_text.startswith('Private'):
|
elif visibility_text.startswith('Unlisted') or visibility_text.startswith('Private'):
|
||||||
paste.public = False
|
paste.public = False
|
||||||
else:
|
else:
|
||||||
raise BrokenPageError('Unable to get the paste visibility')
|
raise BrokenPageError('Unable to get the paste visibility')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue