fix: pages were not in the subclasses because the module was never importet
This commit is contained in:
parent
cef87460a7
commit
c24cf701c1
@ -78,6 +78,8 @@ class Downloader:
|
|||||||
if page_type in self._registered_pages:
|
if page_type in self._registered_pages:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
print(page_type)
|
||||||
|
|
||||||
self._registered_pages[page_type].add(page_type(
|
self._registered_pages[page_type].add(page_type(
|
||||||
download_options=self.download_options,
|
download_options=self.download_options,
|
||||||
fetch_options=self.fetch_options,
|
fetch_options=self.fetch_options,
|
||||||
@ -94,6 +96,7 @@ class Downloader:
|
|||||||
|
|
||||||
def scan_for_pages(self, **kwargs):
|
def scan_for_pages(self, **kwargs):
|
||||||
# assuming the wanted pages are the leaf classes of the interface
|
# assuming the wanted pages are the leaf classes of the interface
|
||||||
|
from .. import pages
|
||||||
leaf_classes = []
|
leaf_classes = []
|
||||||
|
|
||||||
class_list = [Page]
|
class_list = [Page]
|
||||||
@ -342,15 +345,17 @@ class Page:
|
|||||||
cls.LOGGER = logging.getLogger(cls.__name__)
|
cls.LOGGER = logging.getLogger(cls.__name__)
|
||||||
return super().__new__(cls)
|
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):
|
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.SOURCE_TYPE.register_page(self)
|
||||||
|
|
||||||
self.download_options: DownloadOptions = download_options or DownloadOptions()
|
self.download_options: DownloadOptions = download_options or DownloadOptions()
|
||||||
self.fetch_options: FetchOptions = fetch_options or FetchOptions()
|
self.fetch_options: FetchOptions = fetch_options or FetchOptions()
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if self.SOURCE_TYPE is not None:
|
|
||||||
self.SOURCE_TYPE.deregister_page()
|
self.SOURCE_TYPE.deregister_page()
|
||||||
|
|
||||||
def _search_regex(self, pattern, string, default=None, fatal=True, flags=0, group=None):
|
def _search_regex(self, pattern, string, default=None, fatal=True, flags=0, group=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user