Upgrade django-pipeline to fix conflict with sentry-sdk.
[wolnelektury.git] / src / catalogue / import_utils.py
1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
3 #
4 from librarian import DocProvider
5
6
7 class ORMDocProvider(DocProvider):
8     """Used for getting books' children."""
9
10     def __init__(self, book):
11         self.book = book
12
13     def by_slug(self, slug):
14         if slug == self.book.slug:
15             return open(self.book.xml_file.path)
16         else:
17             return type(self.book).objects.get(slug=slug).xml_file