Skip to content

Commit

Permalink
[#1273] pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
kindly committed Nov 20, 2013
1 parent 53d6a1f commit edb65c0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ckan/lib/uploader.py
Expand Up @@ -43,12 +43,14 @@ def get_storage_path():

return _storage_path


def get_max_image_size():
global _max_image_size
if _max_image_size is None:
_max_image_size = int(config.get('ckan.max_image_size', 2))
return _max_image_size


def get_max_resource_size():
global _max_resource_size
if _max_resource_size is None:
Expand Down Expand Up @@ -175,18 +177,16 @@ def __init__(self, resource):
elif self.clear:
resource['url_type'] = ''


def get_directory(self, id):
directory = os.path.join(self.storage_path,
id[0:3], id[3:6])
id[0:3], id[3:6])
return directory

def get_path(self, id):
directory = self.get_directory(id)
filepath = os.path.join(directory, id[6:])
return filepath


def upload(self, id, max_size=10):
if not self.storage_path:
return
Expand All @@ -205,7 +205,8 @@ def upload(self, id, max_size=10):
current_size = 0
while True:
current_size = current_size + 1
data = self.upload_file.read(2 ** 20) #mb chuncks
#MB chunks
data = self.upload_file.read(2 ** 20)
if not data:
break
output_file.write(data)
Expand Down

0 comments on commit edb65c0

Please sign in to comment.