Skip to content
Snippets Groups Projects
Commit a164cd39 authored by Aurélien Dunand's avatar Aurélien Dunand Committed by Seblu
Browse files

Add image retrieval from ftp

parent 61d093f8
No related branches found
No related tags found
No related merge requests found
...@@ -57,7 +57,7 @@ def copy(source, destination, uid=None, gid=None, mode=None, timeout=None): ...@@ -57,7 +57,7 @@ def copy(source, destination, uid=None, gid=None, mode=None, timeout=None):
# trivial case # trivial case
if stype == dtype == "file": if stype == dtype == "file":
shutil.copy(source, destination) shutil.copy(source, destination)
elif stype == "http" and dtype == "file": elif (stype == "http" or stype == "ftp") and dtype == "file":
f_dest = open(destination, "w") f_dest = open(destination, "w")
f_source = urllib2.urlopen(source, timeout=timeout) f_source = urllib2.urlopen(source, timeout=timeout)
f_dest.write(f_source.read()) f_dest.write(f_source.read())
...@@ -113,7 +113,7 @@ def abspath(path): ...@@ -113,7 +113,7 @@ def abspath(path):
Format a path to be absolute Format a path to be absolute
''' '''
ptype = pathtype(path) ptype = pathtype(path)
if ptype in ("http", "ssh"): if ptype in ("http", "ftp", "ssh"):
return path return path
elif ptype == "file": elif ptype == "file":
if path.startswith("file://"): if path.startswith("file://"):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment