Scan files with clamdscan #77

Merged
Anna Sirota merged 17 commits from scan-file into main 2024-04-12 19:11:30 +02:00
Showing only changes of commit b143091ccf - Show all commits

View File

@ -1,7 +1,6 @@
from urllib.parse import urljoin, urlparse from urllib.parse import urljoin, urlparse
import json import json
import logging import logging
import os
from django.conf import settings from django.conf import settings
from django.contrib.sites.shortcuts import get_current_site from django.contrib.sites.shortcuts import get_current_site
@ -41,31 +40,6 @@ def absolute_url(context, path: str) -> str:
return absolutify(path, request=request) return absolutify(path, request=request)
# A (temporary?) copy of this is in services/utils.py. See bug 1055654.
def user_media_path(what):
"""Make it possible to override storage paths in settings.
By default, all storage paths are in the MEDIA_ROOT.
This is backwards compatible.
"""
default = os.path.join(settings.MEDIA_ROOT, what)
key = f'{what.upper()}_PATH'
return getattr(settings, key, default)
# A (temporary?) copy of this is in services/utils.py. See bug 1055654.
def user_media_url(what):
"""
Generate default media url, and make possible to override it from
settings.
"""
default = f'{settings.MEDIA_URL}{what}/'
key = '{}_URL'.format(what.upper().replace('-', '_'))
return getattr(settings, key, default)
class PaginationRenderer: class PaginationRenderer:
def __init__(self, pager): def __init__(self, pager):
self.pager = pager self.pager = pager