first working version of s3 refactor.

This commit is contained in:
Steve Pulec 2015-11-27 13:49:44 -05:00
commit 1df454a632
6 changed files with 86 additions and 35 deletions

View file

@ -1,3 +1,6 @@
from __future__ import unicode_literals
from .models import s3bucket_path_backend
mock_s3bucket_path = s3bucket_path_backend.decorator
# from .models import s3bucket_path_backend
from moto import mock_s3
# mock_s3bucket_path = s3bucket_path_backend.decorator
mock_s3bucket_path = mock_s3

View file

@ -1,19 +1,11 @@
from __future__ import unicode_literals
from .models import s3bucket_path_backend
from .utils import bucket_name_from_url
from .utils import bucket_name_from_url, parse_key_name, is_delete_keys
from moto.s3.responses import ResponseObject
def parse_key_name(pth):
return "/".join(pth.rstrip("/").split("/")[2:])
def is_delete_keys(path, bucket_name):
return path == u'/' + bucket_name + u'/?delete'
S3BucketPathResponseInstance = ResponseObject(
s3bucket_path_backend,
bucket_name_from_url,

View file

@ -9,3 +9,11 @@ def bucket_name_from_url(url):
if len(l) == 0 or l[0] == "":
return None
return l[0]
def parse_key_name(path):
return "/".join(path.rstrip("/").split("/")[2:])
def is_delete_keys(path, bucket_name):
return path == u'/' + bucket_name + u'/?delete'