From 9855c2d54b3e7d08b8a979bedb6f71d400568b5c Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Fri, 10 Jun 2016 19:37:36 +0000 Subject: [PATCH] Added a check for the existence of the media/photos directory. - Legacy-Id: 11315 --- ietf/checks.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ietf/checks.py b/ietf/checks.py index 845f85a4f..290f07ef1 100644 --- a/ietf/checks.py +++ b/ietf/checks.py @@ -71,7 +71,7 @@ def check_doc_email_aliases_exists(app_configs, **kwargs): @checks.register('directories') def check_id_submission_directories(app_configs, **kwargs): errors = [] - for s in ("IDSUBMIT_STAGING_PATH", "IDSUBMIT_REPOSITORY_PATH", "INTERNET_DRAFT_ARCHIVE_DIR"): + for s in ("IDSUBMIT_STAGING_PATH", "IDSUBMIT_REPOSITORY_PATH", "INTERNET_DRAFT_ARCHIVE_DIR", ): p = getattr(settings, s) if not os.path.exists(p): errors.append(checks.Critical( @@ -142,3 +142,21 @@ def check_id_submission_checkers(app_configs, **kwargs): id = "datatracker.E0011", )) return errors + +@checks.register('directories') +def check_media_directories(app_configs, **kwargs): + errors = [] + for s in ("PHOTOS_DIR", ): + p = getattr(settings, s) + if not os.path.exists(p): + errors.append(checks.Critical( + "A directory used for media uploads and serves does not exist at the path given\n" + "in the settings file. The setting is:\n" + " %s = %s" % (s, p), + hint = ("Please either update the local settings to point at the correct directory," + "or if the setting is correct, create the directory."), + id = "datatracker.E0012", + )) + return errors + +