1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from os.path import abspath, join, exists
6 from shutil import rmtree
7 from waiter.settings import WAITER_ROOT
10 def check_abspath(path):
11 abs_path = abspath(join(WAITER_ROOT, path))
12 if not abs_path.startswith(WAITER_ROOT):
13 raise ValueError('Path not inside WAITER_ROOT.')
17 def clear_cache(path):
18 abs_path = check_abspath(path)