fix: pages were not in the subclasses because the module was never importet

This commit is contained in:
Hazel 2024-05-24 15:28:47 +02:00
parent cef87460a7
commit c24cf701c1

View File

@ -78,6 +78,8 @@ class Downloader:
if page_type in self._registered_pages:
return
print(page_type)
self._registered_pages[page_type].add(page_type(
download_options=self.download_options,
fetch_options=self.fetch_options,
@ -94,6 +96,7 @@ class Downloader:
def scan_for_pages(self, **kwargs):
# assuming the wanted pages are the leaf classes of the interface
from .. import pages
leaf_classes = []
class_list = [Page]
@ -342,15 +345,17 @@ class Page:
cls.LOGGER = logging.getLogger(cls.__name__)
return super().__new__(cls)
@classmethod
def is_leaf_page(cls) -> bool:
return len(cls.__subclasses__()) == 0
def __init__(self, download_options: DownloadOptions = None, fetch_options: FetchOptions = None, **kwargs):
if self.SOURCE_TYPE is not None:
self.SOURCE_TYPE.register_page(self)
self.download_options: DownloadOptions = download_options or DownloadOptions()
self.fetch_options: FetchOptions = fetch_options or FetchOptions()
def __del__(self):
if self.SOURCE_TYPE is not None:
self.SOURCE_TYPE.deregister_page()
def _search_regex(self, pattern, string, default=None, fatal=True, flags=0, group=None):