Adds renamed libs for python3.
This commit is contained in:
parent
01fd368c97
commit
571162a54d
@ -1,7 +1,7 @@
|
||||
import unicodedata
|
||||
import re
|
||||
|
||||
from .p3 import ustr
|
||||
from .p3 import ustr, unichr
|
||||
|
||||
# citekey stuff
|
||||
|
||||
|
@ -3,9 +3,7 @@ import subprocess
|
||||
import tempfile
|
||||
import shutil
|
||||
|
||||
import urlparse
|
||||
import httplib
|
||||
import urllib2
|
||||
from .p3 import urlparse, HTTPConnection, urlopen
|
||||
|
||||
|
||||
# files i/o
|
||||
@ -62,7 +60,7 @@ def system_path(path):
|
||||
# dealing with formatless content
|
||||
|
||||
def content_type(path):
|
||||
parsed = urlparse.urlparse(path)
|
||||
parsed = urlparse(path)
|
||||
if parsed.scheme == 'http':
|
||||
return 'url'
|
||||
else:
|
||||
@ -70,8 +68,8 @@ def content_type(path):
|
||||
|
||||
|
||||
def url_exists(url):
|
||||
parsed = urlparse.urlparse(url)
|
||||
conn = httplib.HTTPConnection(parsed.netloc)
|
||||
parsed = urlparse(url)
|
||||
conn = HTTPConnection(parsed.netloc)
|
||||
conn.request('HEAD', parsed.path)
|
||||
response = conn.getresponse()
|
||||
conn.close()
|
||||
|
@ -1,6 +1,6 @@
|
||||
import os
|
||||
import re
|
||||
import urlparse
|
||||
from .p3 import urlparse
|
||||
|
||||
from .content import (check_file, check_directory, read_file, write_file,
|
||||
system_path, check_content, content_type, get_content)
|
||||
@ -122,7 +122,7 @@ class DocBroker(object):
|
||||
|
||||
def in_docsdir(self, docpath):
|
||||
try:
|
||||
parsed = urlparse.urlparse(docpath)
|
||||
parsed = urlparse(docpath)
|
||||
except Exception:
|
||||
return False
|
||||
return parsed.scheme == self.scheme
|
||||
@ -136,7 +136,7 @@ class DocBroker(object):
|
||||
Return absoluted paths of regular ones otherwise.
|
||||
"""
|
||||
if self.in_docsdir(docpath):
|
||||
parsed = urlparse.urlparse(docpath)
|
||||
parsed = urlparse(docpath)
|
||||
if parsed.path == '':
|
||||
docpath = os.path.join(self.docdir, parsed.netloc)
|
||||
else:
|
||||
|
@ -5,11 +5,19 @@ if sys.version_info[0] == 2:
|
||||
import StringIO as io
|
||||
input = raw_input
|
||||
ustr = unicode
|
||||
from urlparse import urlparse
|
||||
from urllib2 import urlopen
|
||||
from httplib import HTTPConnection
|
||||
else:
|
||||
import configparser
|
||||
import io
|
||||
ustr = str
|
||||
from urllib.parse import urlparse
|
||||
from urllib.request import urlopen
|
||||
from http.client import HTTPConnection
|
||||
unichr = chr
|
||||
|
||||
configparser = configparser
|
||||
io = io
|
||||
input = input
|
||||
unichr = unichr
|
||||
|
Loading…
x
Reference in New Issue
Block a user