Repair failing test and fix %U bug
Fix SubredditPage._url_str parsing the wrong URL for 'external' URL types. Make urlparse import agnostic between python2 and 3.
This commit is contained in:
@@ -3,7 +3,11 @@ from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
import time
|
||||
from urllib.parse import urlparse
|
||||
|
||||
try:
|
||||
from urllib.parse import urlparse
|
||||
except ImportError:
|
||||
from urlparse import urlparse
|
||||
|
||||
from . import docs
|
||||
from .content import SubredditContent
|
||||
@@ -125,6 +129,7 @@ class SubredditPage(Page):
|
||||
else:
|
||||
self.refresh_content(order=order)
|
||||
|
||||
|
||||
@SubredditController.register(Command('SORT_6'))
|
||||
def sort_content_gilded(self):
|
||||
if self.content.query:
|
||||
@@ -259,7 +264,7 @@ class SubredditPage(Page):
|
||||
data['url_type'].startswith('x-post'):
|
||||
return data['url']
|
||||
else:
|
||||
return urlparse(data['url']).hostname
|
||||
return urlparse(data['url_full']).hostname
|
||||
|
||||
def _url_attr(self, data):
|
||||
if data['url_full'] in self.config.history:
|
||||
|
||||
Reference in New Issue
Block a user