fix filebroker and contents bugs
This commit is contained in:
parent
6190890646
commit
1f6e25d915
papers
@ -1,4 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
|
||||||
# files i/o
|
# files i/o
|
||||||
|
|
||||||
@ -36,18 +38,18 @@ def write_file(filepath, data):
|
|||||||
|
|
||||||
# dealing with formatless content
|
# dealing with formatless content
|
||||||
|
|
||||||
def get_content(self, path):
|
def get_content(path):
|
||||||
"""Will be useful when we need to get content from url"""
|
"""Will be useful when we need to get content from url"""
|
||||||
return read_file(path)
|
return read_file(path)
|
||||||
|
|
||||||
def move_content(self, source, target, overwrite = False):
|
def move_content(source, target, overwrite = False):
|
||||||
if source == target:
|
if source == target:
|
||||||
return
|
return
|
||||||
if not overwrite and os.path.exists(target):
|
if not overwrite and os.path.exists(target):
|
||||||
raise IOError('target file exists')
|
raise IOError('target file exists')
|
||||||
shutil.move(source, target)
|
shutil.move(source, target)
|
||||||
|
|
||||||
def copy_content(self, source, target, overwrite = False):
|
def copy_content(source, target, overwrite = False):
|
||||||
if source == target:
|
if source == target:
|
||||||
return
|
return
|
||||||
if not overwrite and os.path.exists(target):
|
if not overwrite and os.path.exists(target):
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
|
import re
|
||||||
import urlparse
|
import urlparse
|
||||||
|
|
||||||
from .content import check_file, check_directory, read_file, write_file
|
from .content import check_file, check_directory, read_file, write_file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user