1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-30 13:23:14 +00:00

revert: Python 3.8 compatibility

This commit is contained in:
Junxiang Huang 2025-03-31 14:26:41 +08:00
parent c39c7c1f34
commit b75c717ef6

View File

@ -1190,8 +1190,8 @@ if 'default' in DATABASES and 'mysql' in DATABASES['default'].get('ENGINE', ''):
except:
raise ValueError(f"Invalid database port: {DATABASES['default']['PORT']}")
match CACHE_PROVIDER := os.getenv('CACHE_PROVIDER', 'redis'):
case 'redis':
CACHE_PROVIDER = os.getenv('CACHE_PROVIDER', 'redis')
if CACHE_PROVIDER =='redis':
CACHES['default']['BACKEND'] = 'django.core.cache.backends.redis.RedisCache'
cfg_redis_host = 'redis'
cfg_redis_port = 6379
@ -1220,7 +1220,7 @@ match CACHE_PROVIDER := os.getenv('CACHE_PROVIDER', 'redis'):
except:
pass
case 'memcached':
elif CACHE_PROVIDER == 'memcached':
try:
conf_mem_host, conf_mem_port = CACHES['default']['LOCATION'].split(':')
except:
@ -1234,7 +1234,7 @@ match CACHE_PROVIDER := os.getenv('CACHE_PROVIDER', 'redis'):
'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
'LOCATION': f'{mem_host}:{mem_port}'
}
case _:
else:
raise ValueError(f'Invalid CACHE_PROVIDER: {CACHE_PROVIDER}')
if os.environ.get('ENABLE_SEADOC', ''):