Answers the page at (pn, index). Otherwise search for a page with this name. Raise index errors if it does not exist.
(self, pnOrName, index=0)
| 917 | appendElement = appendPage |
| 918 | |
| 919 | def getPage(self, pnOrName, index=0): |
| 920 | """Answers the page at (pn, index). Otherwise search for a page with this name. |
| 921 | Raise index errors if it does not exist.""" |
| 922 | if pnOrName in self.pages: |
| 923 | if index >= len(self.pages[pnOrName]): |
| 924 | return None |
| 925 | return self.pages[pnOrName][index] |
| 926 | |
| 927 | # In case searching by name, chances are that multiple are answered as list. |
| 928 | pages = self.findPages(name=pnOrName) |
| 929 | if pages: |
| 930 | return pages[0] |
| 931 | return None |
| 932 | |
| 933 | def getPages(self, pn): |
| 934 | """Answers all pages that share the same page number. Raise KeyError if |
no test coverage detected