Skip to content

Commit

Permalink
Deprecate FILE_TYPE_CHECKING = False #10862
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed May 2, 2024
1 parent a4975db commit b9f3899
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
13 changes: 13 additions & 0 deletions arches/apps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
import warnings

from django.conf import settings
from django.core.checks import register, Tags, Error, Warning

### GLOBAL DEPRECATIONS ###
FILE_TYPE_CHECKING_MSG = (
"FILE_TYPE_CHECKING=False is deprecated. Starting with Arches 8.0, "
"uploaded files will always be validated against the FILE_TYPES setting. "
"To opt into this behavior now set FILE_TYPE_CHECKING = True."
)
if not settings.FILE_TYPE_CHECKING:
warnings.warn(FILE_TYPE_CHECKING_MSG, DeprecationWarning)


### SYSTEM CHECKS ###

@register(Tags.security)
def check_cache_backend_for_production(app_configs, **kwargs):
Expand Down
4 changes: 3 additions & 1 deletion arches/install/arches-templates/project_name/settings.py-tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ SEARCH_COMPONENT_LOCATIONS.append('{{ project_name }}.search_components')

LOCALE_PATHS.append(os.path.join(APP_ROOT, 'locale'))

FILE_TYPE_CHECKING = False
# TODO: Remove in Arches 8.0
FILE_TYPE_CHECKING = True

FILE_TYPES = ["bmp", "gif", "jpg", "jpeg", "pdf", "png", "psd", "rtf", "tif", "tiff", "xlsx", "csv", "zip"]
FILENAME_GENERATOR = "arches.app.utils.storage_filename_generator.generate_filename"
UPLOADED_FILES_DIR = "uploadedfiles"
Expand Down
2 changes: 2 additions & 0 deletions arches/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,9 @@
"arches.app.etl_modules",
]

# TODO: Remove in Arches 8.0
FILE_TYPE_CHECKING = False

FILE_TYPES = ["bmp", "gif", "jpg", "jpeg", "pdf", "png", "psd", "rtf", "tif", "tiff", "xlsx", "csv", "zip"]
FILENAME_GENERATOR = "arches.app.utils.storage_filename_generator.generate_filename"
UPLOADED_FILES_DIR = "uploadedfiles"
Expand Down
5 changes: 5 additions & 0 deletions releases/7.6.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ JavaScript:

The minimum supported version of Python is now 3.10. Python 3.11 is encouraged, as it is significantly faster.

### Deprecations

- Setting `FILE_TYPE_CHECKING` to False is deprecated. Starting with Arches 8.0, uploaded files will always be validated against the `FILE_TYPES` setting. To opt into this behavior now set `FILE_TYPE_CHECKING = True`.


### Upgrading Arches

1. You must be upgraded to at least version 7.5.0 before proceeding. If you are on an earlier version, please refer to the upgrade process in the [Version 7.5.0 release notes](https://github.com/archesproject/arches/blob/dev/7.5.x/releases/7.5.0.md)
Expand Down
3 changes: 3 additions & 0 deletions tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
TEST_RUNNER = "tests.base_test.ArchesTestRunner"
SILENCED_SYSTEM_CHECKS.append("arches.W001") # Cache backend does not support rate-limiting

# TODO: remove in Arches 8.0
FILE_TYPE_CHECKING = True

# could add Chrome, PhantomJS etc... here
LOCAL_BROWSERS = [] # ['Firefox']

Expand Down

0 comments on commit b9f3899

Please sign in to comment.