File: files.py

package info (click to toggle)
python-django 3%3A4.2.28-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 58,896 kB
  • sloc: python: 334,975; javascript: 18,754; xml: 215; makefile: 178; sh: 27
file content (19 lines) | stat: -rw-r--r-- 522 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from pathlib import Path

from django.conf import settings

from . import Error, Tags, register


@register(Tags.files)
def check_setting_file_upload_temp_dir(app_configs, **kwargs):
    setting = getattr(settings, "FILE_UPLOAD_TEMP_DIR", None)
    if setting and not Path(setting).is_dir():
        return [
            Error(
                f"The FILE_UPLOAD_TEMP_DIR setting refers to the nonexistent "
                f"directory '{setting}'.",
                id="files.E001",
            ),
        ]
    return []