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