From 1ef93e913238275f7657d496ba3d2e7eeb5a30a2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 May 2015 01:06:01 +0200 Subject: Use 'import' instead 'from' --- module/plugins/hoster/Ftp.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/Ftp.py') diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 5be380078..5258a1c27 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -2,9 +2,8 @@ import pycurl import re - -from urllib import quote, unquote -from urlparse import urlparse +import urllib +import urlparse from module.plugins.Hoster import Hoster @@ -29,12 +28,12 @@ class Ftp(Hoster): def process(self, pyfile): - parsed_url = urlparse(pyfile.url) + parsed_url = urlparse.urlparse(pyfile.url) netloc = parsed_url.netloc pyfile.name = parsed_url.path.rpartition('/')[2] try: - pyfile.name = unquote(str(pyfile.name)).decode('utf8') + pyfile.name = urllib.unquote(str(pyfile.name)).decode('utf8') except Exception: pass @@ -67,11 +66,11 @@ class Ftp(Hoster): #Naive ftp directory listing if re.search(r'^25\d.*?"', self.req.http.header, re.M): pyfile.url = pyfile.url.rstrip('/') - pkgname = "/".join(pyfile.package().name, urlparse(pyfile.url).path.rpartition('/')[2]) + pkgname = "/".join(pyfile.package().name, urlparse.urlparse(pyfile.url).path.rpartition('/')[2]) pyfile.url += '/' self.req.http.c.setopt(48, 1) # CURLOPT_DIRLISTONLY res = self.load(pyfile.url, decode=False) - links = [pyfile.url + quote(x) for x in res.splitlines()] + links = [pyfile.url + urllib.quote(x) for x in res.splitlines()] self.logDebug("LINKS", links) self.core.api.addPackage(pkgname, links) else: -- cgit v1.2.3