Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Commit

Permalink
remove boto3 dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
antonagestam committed Feb 7, 2017
1 parent 8c64f05 commit 293f833
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 13 additions & 0 deletions collectfast/boto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from . import settings


def is_boto3(storage):
return type(storage).__name__ == 'S3Boto3Storage'


def reset_connection(storage):
"""
Reset connection if thread pooling is enabled and storage is boto3.
"""
if settings.threads and is_boto3(storage):
storage._connection = None
6 changes: 2 additions & 4 deletions collectfast/management/commands/collectstatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

from django.contrib.staticfiles.management.commands import collectstatic
from django.utils.encoding import smart_str
from storages.backends.s3boto3 import S3Boto3Storage

from collectfast.etag import should_copy_file
from collectfast.boto import reset_connection
from collectfast import settings


Expand Down Expand Up @@ -78,9 +78,7 @@ def do_copy_file(self, args):
"""
path, prefixed_path, source_storage = args

if settings.threads and isinstance(self.storage, S3Boto3Storage):
# reset connection
self.storage._connection = None
reset_connection(self.storage)

if self.collectfast_enabled and not self.dry_run:
try:
Expand Down

0 comments on commit 293f833

Please sign in to comment.