Simplified implementation of collectstatic command.
Since d2e242d16c6dde6f4736086fb38057424bed3edb made isinstance()
calls work correctly on LazyObject, we can simplify the
implementation of is_local_storage added in
7e27885c6e
.
This commit is contained in:
parent
61917aa08b
commit
5c5b266b54
|
@ -7,7 +7,6 @@ from optparse import make_option
|
||||||
from django.core.files.storage import FileSystemStorage
|
from django.core.files.storage import FileSystemStorage
|
||||||
from django.core.management.base import CommandError, NoArgsCommand
|
from django.core.management.base import CommandError, NoArgsCommand
|
||||||
from django.utils.encoding import smart_text
|
from django.utils.encoding import smart_text
|
||||||
from django.utils.functional import LazyObject
|
|
||||||
from django.utils.six.moves import input
|
from django.utils.six.moves import input
|
||||||
|
|
||||||
from django.contrib.staticfiles import finders, storage
|
from django.contrib.staticfiles import finders, storage
|
||||||
|
@ -193,11 +192,7 @@ class Command(NoArgsCommand):
|
||||||
self.stdout.write(msg)
|
self.stdout.write(msg)
|
||||||
|
|
||||||
def is_local_storage(self):
|
def is_local_storage(self):
|
||||||
if issubclass(self.storage.__class__, LazyObject):
|
return isinstance(self.storage, FileSystemStorage)
|
||||||
storage = self.storage._wrapped
|
|
||||||
else:
|
|
||||||
storage = self.storage
|
|
||||||
return isinstance(storage, FileSystemStorage)
|
|
||||||
|
|
||||||
def clear_dir(self, path):
|
def clear_dir(self, path):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -367,7 +367,7 @@ class SimpleLazyObject(LazyObject):
|
||||||
|
|
||||||
def __deepcopy__(self, memo):
|
def __deepcopy__(self, memo):
|
||||||
if self._wrapped is empty:
|
if self._wrapped is empty:
|
||||||
# We have to use type(self), not self.__class__, because the
|
# We have to use SimpleLazyObject, not self.__class__, because the
|
||||||
# latter is proxied.
|
# latter is proxied.
|
||||||
result = SimpleLazyObject(self._setupfunc)
|
result = SimpleLazyObject(self._setupfunc)
|
||||||
memo[id(self)] = result
|
memo[id(self)] = result
|
||||||
|
|
Loading…
Reference in New Issue