-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.py
41 lines (30 loc) · 939 Bytes
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- coding: utf-8 -*-
import sys
import settings
class Section:
def __init__(self, index, title, subsections, source=None):
self._source = source
self._index = index
self._title = title
self._subsections = subsections
for subsection in self._subsections:
subsection._parent = self
def __str__(self):
return f"[{self._index}] - {self._title}"
def subsections(self):
return self._subsections
def isDefault(self):
return self._source is None
class Subsection:
def __init__(self, index, title, url=None, source=None):
self._parent = None
self._source = source
self._index = index
self._title = title
self._url = url
def __str__(self):
return f"[{self._index}] - {self._title}"
def isDefault(self):
return self._source is None
def url(self):
return self._url