mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-30 18:27:45 -05:00
more tests
This commit is contained in:
@@ -13,18 +13,18 @@ writeable_hint = (
|
||||
)
|
||||
|
||||
|
||||
def path_check(env_var):
|
||||
def path_check(var, directory):
|
||||
messages = []
|
||||
directory = os.getenv(env_var)
|
||||
print(directory)
|
||||
if directory:
|
||||
if not os.path.exists(directory):
|
||||
messages.append(Error(
|
||||
exists_message.format(env_var),
|
||||
exists_message.format(var),
|
||||
exists_hint.format(directory)
|
||||
))
|
||||
elif not os.access(directory, os.W_OK | os.X_OK):
|
||||
messages.append(Error(
|
||||
writeable_message.format(env_var),
|
||||
writeable_message.format(var),
|
||||
writeable_hint.format(directory)
|
||||
))
|
||||
return messages
|
||||
@@ -36,10 +36,10 @@ def paths_check(app_configs, **kwargs):
|
||||
Check the various paths for existence, readability and writeability
|
||||
"""
|
||||
|
||||
check_messages = path_check("PAPERLESS_DATA_DIR") + \
|
||||
path_check("PAPERLESS_MEDIA_ROOT") + \
|
||||
path_check("PAPERLESS_CONSUMPTION_DIR") + \
|
||||
path_check("PAPERLESS_STATICDIR")
|
||||
check_messages = path_check("PAPERLESS_DATA_DIR", settings.DATA_DIR) + \
|
||||
path_check("PAPERLESS_MEDIA_ROOT", settings.MEDIA_ROOT) + \
|
||||
path_check("PAPERLESS_CONSUMPTION_DIR", settings.CONSUMPTION_DIR) + \
|
||||
path_check("PAPERLESS_STATICDIR", settings.STATIC_ROOT)
|
||||
|
||||
return check_messages
|
||||
|
||||
|
Reference in New Issue
Block a user