In wsgi mode, complain when base path or current user path don't exist.
Jelmer Vernooij
3 years ago
7 | 7 |
plugin = python3
|
8 | 8 |
module = xandikos.wsgi:app
|
9 | 9 |
env = XANDIKOSPATH=/var/lib/xandikos/collections
|
10 | |
env = CURRENT_USER_PRINCIPAL=/dav/jelmer/
|
|
10 |
env = CURRENT_USER_PRINCIPAL=/jelmer/
|
19 | 19 |
"""WSGI wrapper for xandikos.
|
20 | 20 |
"""
|
21 | 21 |
|
|
22 |
import logging
|
22 | 23 |
import os
|
23 | 24 |
|
24 | 25 |
from xandikos.web import XandikosBackend, XandikosApp
|
25 | 26 |
|
26 | 27 |
backend = XandikosBackend(path=os.environ['XANDIKOSPATH'])
|
|
28 |
if not os.path.isdir(backend.path):
|
|
29 |
logging.warning('%r does not exist.', backend.path)
|
|
30 |
|
27 | 31 |
current_user_principal = os.environ.get('CURRENT_USER_PRINCIPAL', '/user/')
|
|
32 |
if not backend.get_resource(current_user_principal):
|
|
33 |
logging.warning(
|
|
34 |
'default user principal \'%s\' does not exist. Create directory %s?',
|
|
35 |
current_user_principal, backend._map_to_file_path(
|
|
36 |
current_user_principal))
|
|
37 |
|
28 | 38 |
backend._mark_as_principal(current_user_principal)
|
29 | 39 |
app = XandikosApp(backend, current_user_principal)
|