Skip to content

Commit

Permalink
Move files into internal for now
Browse files Browse the repository at this point in the history
  • Loading branch information
davegaeddert committed Jun 21, 2024
1 parent f13d777 commit 5dae250
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions bolt/bolt/assets/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

from bolt.assets.utils import check_settings, matches_patterns
from bolt.exceptions import ImproperlyConfigured, SuspiciousFileOperation
from bolt.files import File, locks
from bolt.files.base import ContentFile
from bolt.files.move import file_move_safe
from bolt.files.utils import validate_file_name
from bolt.internal.files import File, locks
from bolt.internal.files.base import ContentFile
from bolt.internal.files.move import file_move_safe
from bolt.internal.files.utils import validate_file_name
from bolt.runtime import settings
from bolt.utils._os import safe_join
from bolt.utils.crypto import get_random_string
Expand Down
3 changes: 0 additions & 3 deletions bolt/bolt/files/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion bolt/bolt/http/multipartparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
TooManyFieldsSent,
TooManyFilesSent,
)
from bolt.files.uploadhandler import SkipFile, StopFutureHandlers, StopUpload
from bolt.internal.files.uploadhandler import SkipFile, StopFutureHandlers, StopUpload
from bolt.runtime import settings
from bolt.utils.datastructures import MultiValueDict
from bolt.utils.encoding import force_str
Expand Down
2 changes: 1 addition & 1 deletion bolt/bolt/http/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
RequestDataTooBig,
TooManyFieldsSent,
)
from bolt.files import uploadhandler
from bolt.http.multipartparser import (
MultiPartParser,
MultiPartParserError,
TooManyFilesSent,
)
from bolt.internal.files import uploadhandler
from bolt.runtime import settings
from bolt.utils.datastructures import (
CaseInsensitiveMapping,
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions bolt/bolt/internal/files/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from bolt.internal.files.base import File

__all__ = ["File"]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from io import BytesIO, StringIO, UnsupportedOperation

from bolt.files.utils import FileProxyMixin
from bolt.internal.files.utils import FileProxyMixin
from bolt.utils.functional import cached_property


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Example Usage::
>>> from bolt.files import locks
>>> from bolt.internal.files import locks
>>> with open('./file', 'wb') as f:
... locks.lock(f, locks.LOCK_EX)
... f.write('Bolt')
Expand Down
4 changes: 2 additions & 2 deletions bolt/bolt/files/move.py → bolt/bolt/internal/files/move.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""
Move a file in the safest way possible::
>>> from bolt.files.move import file_move_safe
>>> from bolt.internal.files.move import file_move_safe
>>> file_move_safe("/tmp/old_file", "/tmp/new_file")
"""

import os
from shutil import copymode, copystat

from bolt.files import locks
from bolt.internal.files import locks

__all__ = ["file_move_safe"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import os
import tempfile

from bolt.files.utils import FileProxyMixin
from bolt.internal.files.utils import FileProxyMixin

__all__ = (
"NamedTemporaryFile",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import os
from io import BytesIO

from bolt.files import temp as tempfile
from bolt.files.base import File
from bolt.files.utils import validate_file_name
from bolt.internal.files import temp as tempfile
from bolt.internal.files.base import File
from bolt.internal.files.utils import validate_file_name
from bolt.runtime import settings

__all__ = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
from io import BytesIO

from bolt.files.uploadedfile import InMemoryUploadedFile, TemporaryUploadedFile
from bolt.internal.files.uploadedfile import InMemoryUploadedFile, TemporaryUploadedFile
from bolt.runtime import settings
from bolt.utils.module_loading import import_string

Expand Down Expand Up @@ -243,7 +243,7 @@ def load_handler(path, *args, **kwargs):
>>> from bolt.http import HttpRequest
>>> request = HttpRequest()
>>> load_handler(
... 'bolt.files.uploadhandler.TemporaryFileUploadHandler',
... 'bolt.internal.files.uploadhandler.TemporaryFileUploadHandler',
... request,
... )
<TemporaryFileUploadHandler object at 0x...>
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions bolt/bolt/runtime/global_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@

# List of upload handler classes to be applied in order.
FILE_UPLOAD_HANDLERS = [
"bolt.files.uploadhandler.MemoryFileUploadHandler",
"bolt.files.uploadhandler.TemporaryFileUploadHandler",
"bolt.internal.files.uploadhandler.MemoryFileUploadHandler",
"bolt.internal.files.uploadhandler.TemporaryFileUploadHandler",
]

# Maximum size, in bytes, of a request before it will be streamed to the
Expand Down

0 comments on commit 5dae250

Please sign in to comment.