1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-29 04:01:24 +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: except:
raise ValueError(f"Invalid database port: {DATABASES['default']['PORT']}") raise ValueError(f"Invalid database port: {DATABASES['default']['PORT']}")
match CACHE_PROVIDER := os.getenv('CACHE_PROVIDER', 'redis'): CACHE_PROVIDER = os.getenv('CACHE_PROVIDER', 'redis')
case 'redis': if CACHE_PROVIDER =='redis':
CACHES['default']['BACKEND'] = 'django.core.cache.backends.redis.RedisCache' CACHES['default']['BACKEND'] = 'django.core.cache.backends.redis.RedisCache'
cfg_redis_host = 'redis' cfg_redis_host = 'redis'
cfg_redis_port = 6379 cfg_redis_port = 6379
@ -1220,7 +1220,7 @@ match CACHE_PROVIDER := os.getenv('CACHE_PROVIDER', 'redis'):
except: except:
pass pass
case 'memcached': elif CACHE_PROVIDER == 'memcached':
try: try:
conf_mem_host, conf_mem_port = CACHES['default']['LOCATION'].split(':') conf_mem_host, conf_mem_port = CACHES['default']['LOCATION'].split(':')
except: except:
@ -1234,7 +1234,7 @@ match CACHE_PROVIDER := os.getenv('CACHE_PROVIDER', 'redis'):
'BACKEND': 'django_pylibmc.memcached.PyLibMCCache', 'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
'LOCATION': f'{mem_host}:{mem_port}' 'LOCATION': f'{mem_host}:{mem_port}'
} }
case _: else:
raise ValueError(f'Invalid CACHE_PROVIDER: {CACHE_PROVIDER}') raise ValueError(f'Invalid CACHE_PROVIDER: {CACHE_PROVIDER}')
if os.environ.get('ENABLE_SEADOC', ''): if os.environ.get('ENABLE_SEADOC', ''):